Node.js
Command Line
Error Handling
Debugging
Software Development

Unknown or duplicate parameter NodeCommand

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

The "Unknown or duplicate parameter NodeCommand" error occurs in configuration systems (AWS CloudFormation, Docker Compose, Kubernetes, or CI/CD tools) when a parameter named NodeCommand is either not recognized by the service, specified more than once, or used in the wrong context. This is not a Node.js runtime error — it is a configuration-level error where the tool parsing your template or manifest does not understand the NodeCommand parameter. The fix depends on identifying which tool produces the error and correcting the configuration syntax.

Common Cause 1: AWS CloudFormation / SSM

In AWS Systems Manager (SSM) or CloudFormation, NodeCommand may appear when configuring EC2 user data or SSM documents.

yaml
1# WRONG — NodeCommand is not a valid CloudFormation parameter
2Resources:
3  MyInstance:
4    Type: AWS::EC2::Instance
5    Properties:
6      ImageId: ami-12345678
7      InstanceType: t3.micro
8      NodeCommand: "node server.js"  # Unknown parameter
9
10# CORRECT — use UserData for startup commands
11Resources:
12  MyInstance:
13    Type: AWS::EC2::Instance
14    Properties:
15      ImageId: ami-12345678
16      InstanceType: t3.micro
17      UserData:
18        Fn::Base64: |
19          #!/bin/bash
20          cd /app
21          node server.js

Common Cause 2: Docker Compose

yaml
1# WRONG — nodeCommand is not a Docker Compose key
2services:
3  app:
4    image: node:18
5    nodeCommand: "node server.js"  # Unknown property
6
7# CORRECT — use "command" to override the container's CMD
8services:
9  app:
10    image: node:18
11    command: ["node", "server.js"]
12    # Or string form:
13    # command: node server.js

Common Cause 3: Kubernetes Pod Spec

yaml
1# WRONG — nodeCommand is not a valid Kubernetes field
2spec:
3  containers:
4    - name: app
5      image: node:18
6      nodeCommand: "node server.js"  # Unknown field
7
8# CORRECT — use "command" (equivalent to Docker ENTRYPOINT)
9# and "args" (equivalent to Docker CMD)
10spec:
11  containers:
12    - name: app
13      image: node:18
14      command: ["node"]
15      args: ["server.js"]

Common Cause 4: Duplicate Parameter in Config Files

yaml
1# WRONG — duplicate key in YAML (second value silently overwrites first)
2app:
3  command: "node server.js"
4  port: 3000
5  command: "node app.js"  # Duplicate key — may cause "duplicate parameter" error
6
7# CORRECT — single command key
8app:
9  command: "node server.js"
10  port: 3000
json
1// WRONG — duplicate key in JSON
2{
3  "NodeCommand": "node server.js",
4  "port": 3000,
5  "NodeCommand": "node app.js"
6}
7
8// JSON spec says duplicate keys have undefined behavior
9// Some parsers use the last value, others throw an error

Common Cause 5: CI/CD Pipeline Configuration

yaml
1# GitHub Actions — WRONG
2jobs:
3  build:
4    runs-on: ubuntu-latest
5    steps:
6      - uses: actions/checkout@v4
7      - nodeCommand: "npm run build"  # Unknown step property
8
9# CORRECT
10jobs:
11  build:
12    runs-on: ubuntu-latest
13    steps:
14      - uses: actions/checkout@v4
15      - run: npm run build

Debugging Steps

bash
1# 1. Identify which tool produces the error
2# Check the error message for the tool name (CloudFormation, Docker, Kubernetes, etc.)
3
4# 2. Validate your configuration file
5# YAML lint
6pip install yamllint && yamllint config.yaml
7
8# CloudFormation
9aws cloudformation validate-template --template-body file://template.yaml
10
11# Kubernetes
12kubectl apply --dry-run=client -f deployment.yaml
13
14# Docker Compose
15docker compose config
16
17# 3. Search for duplicate keys
18grep -n "NodeCommand\|nodeCommand\|node_command" config.yaml

Common Pitfalls

  • Using framework-specific parameter names in the wrong tool: A parameter like NodeCommand might be valid in one tool (e.g., a custom Terraform module) but not in another (e.g., CloudFormation). Always check the official documentation for the exact tool and version you are using.
  • YAML duplicate keys silently overwriting: YAML allows duplicate keys but behavior is undefined — some parsers use the last value, others throw errors. Use a YAML linter (yamllint) to detect duplicate keys. Most editors do not highlight this issue.
  • Case sensitivity in parameter names: nodeCommand, NodeCommand, and node_command are three different keys. The tool may only accept one specific casing. Check the documentation for the exact expected format (camelCase, PascalCase, snake_case).
  • Copy-pasting from wrong documentation: Copying configuration examples from a different tool or an outdated version of the same tool introduces unrecognized parameters. Always verify examples against the current version's schema or documentation.
  • Not running dry-run or validation before applying: Tools like kubectl apply --dry-run=client, docker compose config, and aws cloudformation validate-template catch unknown parameters before deployment. Always validate configuration files before applying them to production.

Summary

  • "Unknown or duplicate parameter NodeCommand" is a configuration error, not a Node.js runtime error
  • Check which tool produces the error (CloudFormation, Docker, Kubernetes, CI/CD) and use the correct parameter name
  • Use command in Docker/Kubernetes, UserData in CloudFormation, and run in CI/CD pipelines
  • Validate configuration files with tool-specific linters and dry-run commands
  • Use YAML linters to detect duplicate keys that cause "duplicate parameter" errors

Course illustration
Course illustration

All Rights Reserved.