eyaltoledano/claude-task-master · error · Error

Tag ${tag} not found in standard format

Error message

Tag ${tag} not found in standard format

What it means

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.

Source

Thrown at packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts:733

				if (
					this.formatHandler.detectFormat(data) !== 'legacy' &&
					tag === 'master'
				) {
					// Standard format - mark for file deletion after lock release
					shouldDeleteFile = true;
					return data; // Return unchanged, we'll delete the file after
				}

				if (this.formatHandler.detectFormat(data) === 'legacy') {
					// Legacy format - remove the tag key
					if (tag in data) {
						delete data[tag];
						return data;
					} else {
						throw new Error(`Tag ${tag} not found`);
					}
				} else {
					throw new Error(`Tag ${tag} not found in standard format`);
				}
			});

			// Delete the file if we're removing master tag from standard format
			if (shouldDeleteFile) {
				await this.fileOps.deleteFile(filePath);
			}
		} catch (error: any) {
			if (error.code === 'ENOENT') {
				throw new Error(`Tag ${tag} not found - file doesn't exist`);
			}
			throw error;
		}
	}

	/**
	 * Rename a tag within the single tasks.json file
	 * Uses modifyJson for atomic read-modify-write to prevent lost updates

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Migrate tasks.json to the legacy/tagged format (e.g. via the tag/convert flow) before deleting non-master tags.
  2. Only delete 'master' in standard format if you intend to remove the tasks file entirely.
  3. Detect the format first and branch your code: read the JSON and check for a 'tasks' top-level key vs tag keys.
  4. Re-create the tag in legacy format, then delete it there.

Example fix

// before
await storage.deleteTag('feature'); // standard format file
// after
const data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));
const isStandard = Array.isArray(data.tasks);
if (isStandard && tag !== 'master') {
  await convertToTaggedFormat(tasksPath); // migrate first
}
await storage.deleteTag(tag);
Defensive patterns

Strategy: validation

Validate before calling

const data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));
const isStandardFormat = Array.isArray(data.tasks);
if (isStandardFormat && tag !== 'master') {
  throw new Error(`Convert tasks.json to tagged format before deleting tag '${tag}'`);
}

Type guard

function isStandardFormat(data: unknown): data is { tasks: unknown[]; metadata?: object } {
  return typeof data === 'object' && data !== null && Array.isArray((data as any).tasks);
}

Try / catch

try {
  await storage.deleteTag(tag);
} catch (err) {
  if (err instanceof Error && err.message.includes('not found in standard format')) {
    await migrateToTaggedFormat(tasksPath);
    await storage.deleteTag(tag);
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/918cba8d09439442. Report an issue: GitHub.