{"record":{"id":"8371ef9717fba2ac","repo":"eyaltoledano/claude-task-master","slug":"invalid-task-id-format-trimmedid-expected-f","errorCode":null,"errorMessage":"Invalid task ID format: \"${trimmedId}\". Expected format: \"15\" or \"15.2\"","messagePattern":"Invalid task ID format: \"(.+?)\"\\. Expected format: \"15\" or \"15\\.2\"","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/commands.js","lineNumber":2109,"sourceCode":"\t\t\t\t!validDetailLevels.includes(options.detail.toLowerCase())\n\t\t\t) {\n\t\t\t\tconsole.error(\n\t\t\t\t\tchalk.red(\n\t\t\t\t\t\t`Error: Detail level must be one of: ${validDetailLevels.join(', ')}`\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\t// Validate and parse task IDs if provided\n\t\t\tlet taskIds = [];\n\t\t\tif (options.id) {\n\t\t\t\ttry {\n\t\t\t\t\ttaskIds = options.id.split(',').map((id) => {\n\t\t\t\t\t\tconst trimmedId = id.trim();\n\t\t\t\t\t\t// Support both task IDs (e.g., \"15\") and subtask IDs (e.g., \"15.2\")\n\t\t\t\t\t\tif (!/^\\d+(\\.\\d+)?$/.test(trimmedId)) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid task ID format: \"${trimmedId}\". Expected format: \"15\" or \"15.2\"`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn trimmedId;\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(chalk.red(`Error parsing task IDs: ${error.message}`));\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Validate and parse file paths if provided\n\t\t\tlet filePaths = [];\n\t\t\tif (options.files) {\n\t\t\t\ttry {\n\t\t\t\t\tfilePaths = options.files.split(',').map((filePath) => {\n\t\t\t\t\t\tconst trimmedPath = filePath.trim();\n\t\t\t\t\t\tif (trimmedPath.length === 0) {","sourceCodeStart":2091,"sourceCodeEnd":2127,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/commands.js#L2091-L2127","documentation":"Thrown while parsing the --id option of commands that accept comma-separated task/subtask IDs. Each comma-separated token must match /^\\d+(\\.\\d+)?$/ — a plain numeric task id (\"15\") or one-level subtask id (\"15.2\"). Anything else aborts the whole command with this message.","triggerScenarios":"Running a CLI command like `task-master update-task --id=abc` or `--id=15.2.3` or `--id= 15` with non-numeric or multi-dot tokens; also triggered by stray characters like trailing commas producing empty tokens.","commonSituations":"Paste errors from ticket systems (HAM-123 style IDs), trying to reference sub-subtasks (15.2.1) which this regex rejects, shell quoting issues leaving spaces or quotes in the ID, or scripting with empty ID variables.","solutions":["Use numeric IDs only: --id=15 or --id=15.2.","Remove extra dots/characters; sub-subtasks beyond one level are not accepted here.","Trim whitespace and check for empty tokens between commas in the --id list.","If the task has a non-numeric ID (HAM-123), that format belongs to Hamster/remote mode — use the appropriate command/mode."],"exampleFix":"// before\ntask-master update-task --id=HAM-12.3\n// after\ntask-master update-task --id=12.3","handlingStrategy":"validation","validationCode":"function validateTaskIds(idOption) {\n  return idOption.split(',').map(s => s.trim()).map(s => {\n    if (!/^\\d+(\\.\\d+)?$/.test(s)) throw new Error(`Invalid task ID format: \"${s}\". Expected \"15\" or \"15.2\"`);\n    return s;\n  });\n}\nvalidateTaskIds('15,16.2');","typeGuard":"const isTaskId = (s) => /^\\d+(\\.\\d+)?$/.test(s);","tryCatchPattern":"try {\n  await tm.tasks.update({ id: options.id, prompt });\n} catch (e) {\n  if (e.message.startsWith('Invalid task ID format')) {\n    console.error(chalk.red(`${e.message}\\nUsage: --id=15 or --id=15.2 (comma-separated)`));\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Quote --id values in shell to avoid space/quote artifacts.","Sanitize IDs from external systems to numeric task ids before passing.","Remember only one dot level (task.subtask) is accepted.","Trim and filter empty tokens when assembling comma-separated lists."],"tags":["cli","validation","task-ids","arguments"],"backgroundTag":"invalid-id-format","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}