Zie619/n8n-workflows · error · Error

Product ID is missing

Error message

Product ID is missing

What it means

Thrown by 'Verify Requested Quantity' when the issue-request webhook payload has no `Product ID`. Product ID is the join key for the stock lookup in Google Sheets ('Check Available Stock for Issue'), so the workflow cannot proceed without it.

Source

Thrown at workflows/Code/0926_Code_Webhook_Create_Webhook.json:1605

        6340,
        3400
      ],
      "parameters": {
        "jsCode": "const input = $input.all()[0].json;\nconst quantityRequested= input[\"Quantity Requested\"];\n\nif (quantityRequested <= 0) throw new Error(`Invalid quantity Requested: ${quantityRequested}. Must be greater than 0`);\n\nreturn { json: input };"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "6d88db70-6b4f-47c5-8093-ab339762edbe",
      "name": "Verify Requested Quantity",
      "type": "n8n-nodes-base.code",
      "position": [
        6560,
        3400
      ],
      "parameters": {
        "jsCode": "const input = $input.all()[0].json;\nconst quantityRequested = input[\"Quantity Requested\"];\nif (!input[\"Product ID\"]) throw new Error(\"Product ID is missing\");\nif (quantityRequested <= 0) throw new Error(`Invalid quantity requested: ${quantityRequested}`);\nif (!input[\"Submission ID\"]) throw new Error(\"Submission ID is missing\");\nreturn { json: input };"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "bd2313cc-e3c9-4405-a1ed-8f64969e5bca",
      "name": "Check Available Stock for Issue",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        7000,
        3240
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json[\"Product ID\"] }}",

View on GitHub (pinned to 94007c1445)

Solutions

  1. Make Product ID required in the submission form and match the exact key 'Product ID'.
  2. Log Object.keys(input) in the error to expose the real field names when mismatches occur.
  3. Validate at the webhook entry and return a 400-style response to the submitter immediately.
  4. If IDs arrive in different cases, normalize keys once (e.g. map product_id -> 'Product ID') in a single normalization node.

Example fix

// before
if (!input["Product ID"]) throw new Error("Product ID is missing");

// after
const productId = input["Product ID"] ?? input["product_id"];
if (typeof productId !== 'string' || productId.trim() === '') {
  throw new Error(`Product ID is missing (available fields: ${Object.keys(input).join(', ')})`);
}
Defensive patterns

Strategy: validation

Validate before calling

const productId = input['Product ID'] ?? input['product_id'];
if (typeof productId !== 'string' || productId.trim() === '') {
  throw new Error(`Product ID is missing (fields: ${Object.keys(input).join(', ')})`);
}

Type guard

const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;

Prevention

When it happens

Trigger: Form submitted with Product ID blank or omitted; field named differently (e.g. 'product_id' or 'Product'); payload truncated by size limits or transformation between webhook and this node.

Common situations: Optional product selector in the form; renaming form fields without updating downstream n8n references; copy-paste errors in manual API calls.

Related errors


AI-assisted analysis of Zie619/n8n-workflows@94007c1445 (2026-08-15). Data as JSON: /api/errors/7a024721b0b5fb95. Report an issue: GitHub.