Zie619/n8n-workflows · error · Error

The video ID parameter is empty.

Error message

The video ID parameter is empty.

What it means

Identical validation to error 100, in a copy of the 'Create YouTube API URL' Code node in an automation-triggered workflow: it takes $input.first(), reads item.json.VIDEO_ID, and throws when falsy before building the YouTube Data API URL. The difference from error 100 is the trigger (automation/webhook chain in file 1831) and node position, not the logic.

Source

Thrown at workflows/Splitout/1831_Splitout_Code_Automation_Webhook.json:66

      "parameters": {
        "color": 7,
        "width": 1730,
        "height": 760,
        "content": "## 🛠️YouTube Video Details & Comments Processing Tool"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "454c3494-9808-475d-ad53-decd54d99783",
      "name": "Create YouTube API URL",
      "type": "n8n-nodes-base.code",
      "position": [
        500,
        100
      ],
      "parameters": {
        "jsCode": "// Define the base URL for the YouTube Data API\nconst BASE_URL = '{{ $env.API_BASE_URL }}';\n\n// Get the first input item\nconst item = $input.first();\n\n// Extract the videoId and google_api_key from the input JSON\nconst VIDEO_ID = item.json.VIDEO_ID;\nconst GOOGLE_API_KEY = item.json.GOOGLE_API_KEY; // Dynamically retrieve API key\n\nif (!VIDEO_ID) {\n  throw new Error('The video ID parameter is empty.');\n}\n\nif (!GOOGLE_API_KEY) {\n  throw new Error('The Google API Key is missing.');\n}\n\n// Construct the API URL with the video ID and dynamically retrieved API key\nconst youtubeUrl = `${BASE_URL}?part=snippet,contentDetails,status,statistics,player,topicDetails&id=${VIDEO_ID}&key=${GOOGLE_API_KEY}`;\n\n// Return the constructed URL\nreturn [\n  {\n    json: {\n      youtubeUrl: youtubeUrl,\n    },\n  },\n];\n"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "d715b012-7842-498c-8fda-1b2812b7bc1e",
      "name": "Get YouTube Video Details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        700,
        100
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {}
      },
      "typeVersion": 4.2,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."

View on GitHub (pinned to 94007c1445)

Solutions

  1. Execute once with the trigger pinned and log Object.keys($input.first().json) to find the real field name carrying the video ID.
  2. Fix the upstream mapping (webhook 'Include Fields' / Set node) so VIDEO_ID is populated on every item.
  3. Branch items with a missing ID to an error path (IF node) rather than aborting the run for all items.
  4. Accept common casing variants before validating.

Example fix

// before
const VIDEO_ID = item.json.VIDEO_ID;
if (!VIDEO_ID) {
  throw new Error('The video ID parameter is empty.');
}

// after
const VIDEO_ID = item.json.VIDEO_ID || item.json.video_id || item.json.videoId;
if (!VIDEO_ID) {
  throw new Error(`The video ID parameter is empty. Available keys: ${Object.keys(item.json).join(', ')}`);
}
Defensive patterns

Strategy: validation

Validate before calling

const item = $input.first();
const VIDEO_ID = item.json.VIDEO_ID || item.json.video_id || item.json.videoId;
if (!VIDEO_ID || !String(VIDEO_ID).trim()) {
  throw new Error(`VIDEO_ID missing. Keys: ${Object.keys(item.json).join(', ')}`);
}

Type guard

const hasVideoId = (j) => Boolean(j && String(j.VIDEO_ID ?? j.video_id ?? '').trim());

Prevention

When it happens

Trigger: The webhook/automation payload that feeds this chain lacks VIDEO_ID, an upstream Split Out emitted an item with an empty ID cell, or the field name/casing differs (video_id, videoID, nested under data.VIDEO_ID).

Common situations: Trigger payload schema changed by the calling system, upstream sheet column with blank cells, webhook query param not mapped into json, or manual executions without the trigger data.

Related errors


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