{"record":{"id":"967e23714f5c9dfb","repo":"eyaltoledano/claude-task-master","slug":"failed-to-get-tags-error-message","errorCode":null,"errorMessage":"Failed to get tags: ${error.message}","messagePattern":"Failed to get tags: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts","lineNumber":322,"sourceCode":"\t */\n\tasync exists(_tag?: string): Promise<boolean> {\n\t\tconst filePath = this.pathResolver.getTasksPath();\n\t\treturn this.fileOps.exists(filePath);\n\t}\n\n\t/**\n\t * Get all available tags from the single tasks.json file\n\t */\n\tasync getAllTags(): Promise<string[]> {\n\t\ttry {\n\t\t\tconst filePath = this.pathResolver.getTasksPath();\n\t\t\tconst data = await this.fileOps.readJson(filePath);\n\t\t\treturn this.formatHandler.extractTags(data);\n\t\t} catch (error: any) {\n\t\t\tif (error.code === 'ENOENT') {\n\t\t\t\treturn []; // File doesn't exist\n\t\t\t}\n\t\t\tthrow new Error(`Failed to get tags: ${error.message}`);\n\t\t}\n\t}\n\n\t/**\n\t * Load metadata from the single tasks.json file for a specific tag\n\t */\n\tasync loadMetadata(tag?: string): Promise<TaskMetadata | null> {\n\t\tconst filePath = this.pathResolver.getTasksPath();\n\t\tconst resolvedTag = tag || 'master';\n\n\t\ttry {\n\t\t\tconst rawData = await this.fileOps.readJson(filePath);\n\t\t\treturn this.formatHandler.extractMetadata(rawData, resolvedTag);\n\t\t} catch (error: any) {\n\t\t\tif (error.code === 'ENOENT') {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tthrow new Error(`Failed to load metadata: ${error.message}`);","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts#L304-L340","documentation":"getAllTags() reads tasks.json and uses the format handler to extract the list of tag names. A missing file (ENOENT) returns an empty array; any other read/parse error is wrapped in this error so callers always see a consistent message for tag listing failures.","triggerScenarios":"tasks.json contains invalid JSON (readJson parse throws non-ENOENT), permission errors on the file, extractTags encountering an unexpected data shape, or the storage path pointing to a directory.","commonSituations":"Corrupted tasks.json after a failed concurrent write, tags structure manually removed from the file, running under a user without read access to .taskmaster/, or a custom format handler mismatched with the on-disk format.","solutions":["Check error.message for the underlying cause (parse vs access)","Validate/repair tasks.json, especially the top-level tags structure","Restore tasks.json from git or backup","Fix directory/file permissions for the current process user"],"exampleFix":"// before: corrupted tags section\n{ \"tags\": null, \"master\": { \"tasks\": [] } }\n// after\n{ \"tags\": { \"master\": { \"tasks\": [] } } }","handlingStrategy":"try-catch","validationCode":"function tagsSectionIsValid(path = '.taskmaster/tasks.json') {\n  try {\n    const d = JSON.parse(readFileSync(path, 'utf8'));\n    return d.tags === undefined || typeof d.tags === 'object';\n  } catch { return false; }\n}","typeGuard":"function isGetTagsError(e: unknown): e is Error {\n  return e instanceof Error && e.message.startsWith('Failed to get tags:');\n}","tryCatchPattern":"try {\n  const tags = await storage.getAllTags();\n} catch (e) {\n  if (isGetTagsError(e)) {\n    // inspect inner cause; ENOENT cannot reach here (returns []), so it's parse/access\n    console.error('Tag listing failed:', e.message);\n  } else throw e;\n}","preventionTips":["Preserve the tags structure when editing tasks.json manually","Validate the file after any script modifies it","Lock down write access to .taskmaster/ to avoid concurrent corruption","Match the storage adapter's format handler to the on-disk format version"],"tags":["storage","file-io","tags"],"backgroundTag":"file-read-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}