{"record":{"id":"918cba8d09439442","repo":"eyaltoledano/claude-task-master","slug":"tag-tag-not-found-in-standard-format","errorCode":null,"errorMessage":"Tag ${tag} not found in standard format","messagePattern":"Tag (.+?) not found in standard format","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts","lineNumber":733,"sourceCode":"\t\t\t\tif (\n\t\t\t\t\tthis.formatHandler.detectFormat(data) !== 'legacy' &&\n\t\t\t\t\ttag === 'master'\n\t\t\t\t) {\n\t\t\t\t\t// Standard format - mark for file deletion after lock release\n\t\t\t\t\tshouldDeleteFile = true;\n\t\t\t\t\treturn data; // Return unchanged, we'll delete the file after\n\t\t\t\t}\n\n\t\t\t\tif (this.formatHandler.detectFormat(data) === 'legacy') {\n\t\t\t\t\t// Legacy format - remove the tag key\n\t\t\t\t\tif (tag in data) {\n\t\t\t\t\t\tdelete data[tag];\n\t\t\t\t\t\treturn data;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`Tag ${tag} not found`);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(`Tag ${tag} not found in standard format`);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Delete the file if we're removing master tag from standard format\n\t\t\tif (shouldDeleteFile) {\n\t\t\t\tawait this.fileOps.deleteFile(filePath);\n\t\t\t}\n\t\t} catch (error: any) {\n\t\t\tif (error.code === 'ENOENT') {\n\t\t\t\tthrow new Error(`Tag ${tag} not found - file doesn't exist`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Rename a tag within the single tasks.json file\n\t * Uses modifyJson for atomic read-modify-write to prevent lost updates","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts#L715-L751","documentation":"In deleteTag, when the tasks.json is in standard format (a single {tasks, metadata} document with no tag keys), the only tag that can be deleted is 'master' (which deletes the whole file). Requesting any other tag against a standard-format file throws this error, distinguishing 'file format wrong for this operation' from the legacy 'tag key missing' case.","triggerScenarios":"storage.deleteTag('feature') while tasks.json is standard (un-migrated) format; deleting any non-master tag before the file has been converted to legacy/tagged format; scripts assuming tagged storage after a fresh init that still writes standard format.","commonSituations":"Older projects whose tasks.json predates multi-tag support; a recent library version change that introduced tagged format; automation written for legacy files run against an unmigrated file; init-created files not yet converted.","solutions":["Migrate tasks.json to the legacy/tagged format (e.g. via the tag/convert flow) before deleting non-master tags.","Only delete 'master' in standard format if you intend to remove the tasks file entirely.","Detect the format first and branch your code: read the JSON and check for a 'tasks' top-level key vs tag keys.","Re-create the tag in legacy format, then delete it there."],"exampleFix":"// before\nawait storage.deleteTag('feature'); // standard format file\n// after\nconst data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));\nconst isStandard = Array.isArray(data.tasks);\nif (isStandard && tag !== 'master') {\n  await convertToTaggedFormat(tasksPath); // migrate first\n}\nawait storage.deleteTag(tag);","handlingStrategy":"validation","validationCode":"const data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));\nconst isStandardFormat = Array.isArray(data.tasks);\nif (isStandardFormat && tag !== 'master') {\n  throw new Error(`Convert tasks.json to tagged format before deleting tag '${tag}'`);\n}","typeGuard":"function isStandardFormat(data: unknown): data is { tasks: unknown[]; metadata?: object } {\n  return typeof data === 'object' && data !== null && Array.isArray((data as any).tasks);\n}","tryCatchPattern":"try {\n  await storage.deleteTag(tag);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('not found in standard format')) {\n    await migrateToTaggedFormat(tasksPath);\n    await storage.deleteTag(tag);\n    return;\n  }\n  throw err;\n}","preventionTips":["Detect file format before any tag operation and branch on it.","Migrate legacy/un-migrated files to tagged format during project setup.","In standard format, only 'master' is a deletable tag (and it removes the file).","Document format assumptions in scripts that touch tasks.json directly."],"tags":["tag-management","file-format","not-found","migration"],"backgroundTag":"tag-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}