Zie619/n8n-workflows · error · Error
The video ID parameter is empty.
Error message
The video ID parameter is empty.
What it means
Multi-item variant of errors 100/104: the 'Create YouTube API URL' Code node maps over $input.all() and throws 'The video ID parameter is empty.' if ANY item lacks item.json.VIDEO_ID (or GOOGLE_API_KEY in the next check). Because map() aborts on the first bad item, one bad row in a scheduled batch fails the whole run.
Source
Thrown at workflows/Telegram/1982_Telegram_Splitout_Automation_Scheduled.json:110
"type": "array",
"value": "={{ $json[\"YouTube Channel Ids\"].length > 0 ? $json[\"YouTube Channel Ids\"] : $json[\"Default YouTube Channel Ids\"] }}"
}
]
}
},
"typeVersion": 3.4,
"notes": "This set node performs automated tasks as part of the workflow."
},
{
"id": "7c8b43fb-52c9-4a3e-b5ff-2c21fe8fb183",
"name": "Create YouTube API URL",
"type": "n8n-nodes-base.code",
"position": [
1380,
-220
],
"parameters": {
"jsCode": "// Define the base URL for the YouTube Data API\nconst BASE_URL = '{{ $env.API_BASE_URL }}';\n\n// Get all input items\nconst items = $input.all();\n\n// Process each item and create YouTube URLs\nconst results = items.map(item => {\n const VIDEO_ID = item.json.VIDEO_ID;\n const GOOGLE_API_KEY = item.json.GOOGLE_API_KEY;\n\n if (!VIDEO_ID) {\n throw new Error('The video ID parameter is empty.');\n }\n\n if (!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\n const youtubeUrl = `${BASE_URL}?part=snippet,contentDetails,status,statistics,player,topicDetails&id=${VIDEO_ID}&key=${GOOGLE_API_KEY}`;\n\n return {\n json: {\n youtubeUrl: youtubeUrl\n }\n };\n});\n\n// Return array of results\nreturn results;\n\n"
},
"typeVersion": 2,
"notes": "This code node performs automated tasks as part of the workflow."
},
{
"id": "1941d169-f91f-4500-af55-deb7a5b2bc23",
"name": "Get YouTube Video Details",
"type": "n8n-nodes-base.httpRequest",
"position": [
1580,
-220
],
"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
- Filter empty IDs upstream: add an IF/Filter node (VIDEO_ID is not empty) before this code node.
- Inside the map, skip bad items instead of throwing: filter items first, then map; log skipped count.
- If every item must have an ID, fix the source data and add NOT-empty/required constraints in the sheet/DB.
- Pin the failing execution's input to identify which row was empty.
Example fix
// before
const results = items.map(item => {
const VIDEO_ID = item.json.VIDEO_ID;
if (!VIDEO_ID) {
throw new Error('The video ID parameter is empty.');
}
// ...
});
// after - skip invalid rows, fail only if none remain
const valid = items.filter(i => i.json.VIDEO_ID && i.json.GOOGLE_API_KEY);
if (valid.length < items.length) {
console.warn(`Skipped ${items.length - valid.length} items missing VIDEO_ID/GOOGLE_API_KEY`);
}
if (valid.length === 0) {
throw new Error('All items are missing VIDEO_ID or GOOGLE_API_KEY.');
}
const results = valid.map(item => { /* unchanged URL construction */ }); Defensive patterns
Strategy: validation
Validate before calling
const valid = items.filter(i => i.json.VIDEO_ID && i.json.GOOGLE_API_KEY);
if (valid.length === 0) {
throw new Error('All items missing VIDEO_ID or GOOGLE_API_KEY — check the data source.');
}
console.warn(`Skipped ${items.length - valid.length} invalid items`); Type guard
const hasRequiredFields = (item) => Boolean(item?.json?.VIDEO_ID && item?.json?.GOOGLE_API_KEY);
Prevention
- Add a Filter node (VIDEO_ID is not empty) before the code node so bad rows never reach the map().
- In scheduled batch jobs, skip-and-log invalid rows instead of throwing — one empty cell should not kill the nightly run.
- Add data-source constraints (sheet validation, DB NOT NULL) so incomplete rows cannot exist.
When it happens
Trigger: A scheduled trigger pulling a batch of rows where at least one row has a blank VIDEO_ID cell (sheet/DB), an upstream filter that should have excluded empty IDs not applied, or mixed-shape items after a merge node.
Common situations: Google Sheets/Airtable rows with optional video IDs, nightly cron jobs dying on one incomplete row, or a merge combining items from two sources where one source uses a different field name.
Related errors
- The video ID parameter is empty.
- The video ID parameter is empty.
- Approved quantity must be greater than 0
- The Google API Key is missing.
- One or more input arrays are empty. Check your previous node
AI-assisted analysis of Zie619/n8n-workflows@94007c1445 (2026-08-15).
Data as JSON: /api/errors/358c9d41e6aa4877.
Report an issue: GitHub.