{"record":{"id":"0b44c7c8d78c75fe","repo":"EveryInc/compound-engineering-plugin","slug":"unknown-cleanup-target-target-use-one-of-c","errorCode":null,"errorMessage":"Unknown cleanup target: ${target}. Use one of: ${cleanupTargets.join(\", \")}, all","messagePattern":"Unknown cleanup target: (.+?)\\. Use one of: (.+?), all","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/commands/cleanup.ts","lineNumber":650,"sourceCode":"  if (!(await isLegacyAgentArtifactOwned(artifactPath, legacyName, extension))) return 0\n  await moveLegacyArtifactToBackup(managedDir, kind, artifactRoot, relativePath, label)\n  return 1\n}\n\nfunction legacyAgentNameFromPath(relativePath: string, extension: string | null): string {\n  const baseName = path.basename(relativePath)\n  if (!extension) return baseName\n  return baseName.endsWith(extension)\n    ? baseName.slice(0, -extension.length)\n    : path.basename(baseName, path.extname(baseName))\n}\n\nfunction resolveCleanupTargets(targetArg: string): CleanupTarget[] {\n  if (targetArg === \"all\") return [...cleanupTargets]\n  const targets = targetArg.split(\",\").map((entry) => entry.trim()).filter(Boolean)\n  for (const target of targets) {\n    if (!cleanupTargets.includes(target as CleanupTarget)) {\n      throw new Error(`Unknown cleanup target: ${target}. Use one of: ${cleanupTargets.join(\", \")}, all`)\n    }\n  }\n  return targets as CleanupTarget[]\n}\n\nasync function resolveCleanupPluginPath(input: string): Promise<string> {\n  if (input.startsWith(\".\") || input.startsWith(\"/\") || input.startsWith(\"~\")) {\n    const expanded = expandHome(input)\n    const directPath = path.resolve(expanded)\n    if (await pathExists(directPath)) return directPath\n    throw new Error(`Local plugin path not found: ${directPath}`)\n  }\n\n  const repoRoot = fileURLToPath(new URL(\"../..\", import.meta.url))\n  const rootManifestPath = path.join(repoRoot, \".claude-plugin\", \"plugin.json\")\n  if (await pathExists(rootManifestPath)) {\n    try {\n      const raw = await fs.readFile(rootManifestPath, \"utf8\")","sourceCodeStart":632,"sourceCodeEnd":668,"githubUrl":"https://github.com/EveryInc/compound-engineering-plugin/blob/c9c10f8c75412c7232cb2bd663e5fd1cea98d84e/src/commands/cleanup.ts#L632-L668","documentation":"`cleanup --target` accepts only the known cleanup targets — codex, opencode, pi, kiro, copilot, droid, qwen, windsurf — the literal \"all\", or a comma-separated list of those. `resolveCleanupTargets` splits the argument on commas and throws this error naming the first unrecognized entry, echoing the full list of valid values.","triggerScenarios":"Calling `cleanup --target claude` (typo or unsupported agent name), `--target \"codex, claude-code\"` where one comma entry is invalid, or shell-expansion artifacts like an empty-but-nonblank token. Note empty entries are filtered out, so trailing commas are fine.","commonSituations":"Guessing agent names not in the cleanup list (e.g. \"gemini\", \"cursor\", \"claude\"); copy-pasting a target list from an older version of the CLI that had different targets; case mistakes (\"Codex\" — matching is case-sensitive).","solutions":["Use only listed targets: codex, opencode, pi, kiro, copilot, droid, qwen, windsurf — or \"all\".","Fix typos and casing in each comma-separated entry (matching is exact and case-sensitive).","Run `cleanup --help` (or read src/commands/cleanup.ts:30) to confirm the current target list for your CLI version."],"exampleFix":"// before\nbun run src/index.ts cleanup --target claude,gemini\n// Error: Unknown cleanup target: claude. Use one of: codex, opencode, pi, kiro, copilot, droid, qwen, windsurf, all\n\n// after\nbun run src/index.ts cleanup --target codex,opencode","handlingStrategy":"validation","validationCode":"const CLEANUP_TARGETS = [\"codex\",\"opencode\",\"pi\",\"kiro\",\"copilot\",\"droid\",\"qwen\",\"windsurf\"] as const\nconst requested = (process.argv.target ?? \"all\").split(\",\").map(s => s.trim()).filter(Boolean)\nconst bad = requested.filter(t => !(CLEANUP_TARGETS as readonly string[]).includes(t) && t !== \"all\")\nif (bad.length) throw new Error(`Invalid cleanup target(s): ${bad.join(\", \")}`)","typeGuard":"type CleanupTarget = typeof [\"codex\",\"opencode\",\"pi\",\"kiro\",\"copilot\",\"droid\",\"qwen\",\"windsurf\"][number]\nfunction isCleanupTarget(t: string): t is CleanupTarget {\n  return ([\"codex\",\"opencode\",\"pi\",\"kiro\",\"copilot\",\"droid\",\"qwen\",\"windsurf\"] as const).includes(t as never)\n}","tryCatchPattern":"try {\n  await cleanup({ target })\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith(\"Unknown cleanup target:\")) {\n    console.error(e.message) // lists valid targets\n    process.exitCode = 2\n  } else throw e\n}","preventionTips":["Use `--target all` unless you specifically need a subset.","Keep target names lowercase and copy them from `cleanup --help`.","In scripts, build target lists from the same constant the CLI uses instead of hardcoding strings."],"tags":["cli","validation","argument-parsing"],"backgroundTag":"invalid-enum-argument","analyzedSha":"c9c10f8c75412c7232cb2bd663e5fd1cea98d84e","analyzedAt":"2026-08-31T15:18:07.959Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}