{"record":{"id":"03334bb8cb353677","repo":"eyaltoledano/claude-task-master","slug":"tag-is-required","errorCode":null,"errorMessage":"Tag is required","messagePattern":"Tag is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/utils/contextGatherer.js","lineNumber":968,"sourceCode":"\t\t\t\treturn sections.join('\\n\\n');\n\t\t\tcase 'system-prompt':\n\t\t\t\treturn sections.join(' ');\n\t\t\tdefault:\n\t\t\t\treturn sections.join('\\n\\n');\n\t\t}\n\t}\n}\n\n/**\n * Factory function to create a context gatherer instance\n * @param {string} projectRoot - Project root directory\n * @param {string} tag - Tag for the task\n * @returns {ContextGatherer} Context gatherer instance\n * @throws {Error} If tag is not provided\n */\nexport function createContextGatherer(projectRoot, tag) {\n\tif (!tag) {\n\t\tthrow new Error('Tag is required');\n\t}\n\treturn new ContextGatherer(projectRoot, tag);\n}\n\nexport default ContextGatherer;\n","sourceCodeStart":950,"sourceCodeEnd":974,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/utils/contextGatherer.js#L950-L974","documentation":"createContextGatherer() is a factory that requires a tag because every ContextGatherer instance scopes its context gathering to one task tag. It throws when the tag argument is missing, null, undefined, or an empty string.","triggerScenarios":"Calling createContextGatherer(projectRoot) with only one argument; calling it with a tag variable that is '' or undefined because getCurrentTag()/config resolution failed before the call.","commonSituations":"A tag was not set in config (no 'current' tag in .taskmaster/config.json) so the resolved tag was empty; refactoring removed the tag argument; calling the factory before tag selection/creation in an interactive flow.","solutions":["Pass an explicit tag: createContextGatherer(projectRoot, 'master')","Resolve the current tag before the call and fall back to a default: const tag = currentTag || 'master'","Ensure a current tag is set in .taskmaster/config.json before invoking","Check where the tag variable is produced and fix the undefined/empty value"],"exampleFix":"// before\nconst gatherer = createContextGatherer(projectRoot, currentTag);\n// after\nconst tag = currentTag || 'master';\nconst gatherer = createContextGatherer(projectRoot, tag);","handlingStrategy":"validation","validationCode":"if (typeof tag !== 'string' || tag.length === 0) {\n  throw new TypeError('createContextGatherer requires a non-empty tag string');\n}\nconst gatherer = createContextGatherer(projectRoot, tag);","typeGuard":"function hasTag(t) {\n  return typeof t === 'string' && t.trim().length > 0;\n}","tryCatchPattern":"try {\n  const gatherer = createContextGatherer(projectRoot, tag);\n} catch (err) {\n  if (err.message === 'Tag is required') {\n    const fallback = createContextGatherer(projectRoot, 'master');\n    return fallback;\n  }\n  throw err;\n}","preventionTips":["Resolve the current tag (config .taskmaster/config.json) before building the gatherer","Fall back to 'master' when no tag is configured","Never call the factory with a possibly-empty variable without a guard","Create/select a tag early in your flow before gathering context"],"tags":["argument-validation","context-gatherer","tag-required"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}