{"record":{"id":"419c93aa75db093a","repo":"EveryInc/compound-engineering-plugin","slug":"command-args-join-failed-detail","errorCode":null,"errorMessage":"${command} ${args.join(\" \")} failed: ${detail}","messagePattern":"(.+?) (.+?) failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/dev/codex-dev.ts","lineNumber":104,"sourceCode":"\nconst OFFICIAL_PLUGIN_ID = \"compound-engineering@compound-engineering-plugin\"\nconst OFFICIAL_MARKETPLACE = \"compound-engineering-plugin\"\nconst OFFICIAL_REPOSITORY = \"https://github.com/EveryInc/compound-engineering-plugin\"\n\nfunction trim(result: CommandResult): string {\n  return result.stdout.trim()\n}\n\nasync function checkedRun(\n  runner: CommandRunner,\n  command: string,\n  args: string[],\n  options: CommandOptions,\n): Promise<CommandResult> {\n  const result = await runner.run(command, args, options)\n  if (result.exitCode !== 0) {\n    const detail = result.stderr.trim() || result.stdout.trim() || `exit code ${result.exitCode}`\n    throw new Error(`${command} ${args.join(\" \")} failed: ${detail}`)\n  }\n  return result\n}\n\nfunction resolveHomePath(value: string, home: string): string {\n  if (value === \"~\") return home\n  if (value.startsWith(\"~/\")) return path.join(home, value.slice(2))\n  return path.resolve(value)\n}\n\nasync function readJson(filePath: string): Promise<Record<string, unknown>> {\n  try {\n    return JSON.parse(await fs.readFile(filePath, \"utf8\")) as Record<string, unknown>\n  } catch (error) {\n    throw new Error(`Could not read ${filePath}: ${error instanceof Error ? error.message : String(error)}`)\n  }\n}\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/EveryInc/compound-engineering-plugin/blob/c9c10f8c75412c7232cb2bd663e5fd1cea98d84e/src/dev/codex-dev.ts#L86-L122","documentation":"The Codex dev tooling wraps every git invocation in `checkedRun`, which runs the command and throws this error if the exit code is non-zero, preferring stderr for the detail, then stdout, then a bare `exit code N`. It is a generic gatekeeper so any git failure during dev-script setup (resolving repo root, git dir, branch, HEAD, status) surfaces with its git output attached.","triggerScenarios":"Any `checkedRun(command, args, ...)` callee — repoRootRaw, gitDir, gitCommonDir, branchValue, head, status — failing: running outside a git repo (`git rev-parse` fails), corrupt .git directory, detached/unborn HEAD, unsafe-repository ownership error, or git missing from PATH.","commonSituations":"Running the dev script outside a git checkout; a worktree/submodule with unusual git dir layout; `detected dubious ownership` after copying a repo as root; corrupted or partially-deleted .git; git not installed.","solutions":["Read the embedded git detail (stderr/stdout) — it names the failing git subcommand's cause.","Confirm you are inside the intended git repository/worktree (`git rev-parse --git-dir`).","For 'dubious ownership', add the repo: `git config --global --add safe.directory <path>`.","If .git is corrupt, re-clone or restore the repo.","Ensure git is installed and on PATH."],"exampleFix":"// before (message: 'git rev-parse --show-toplevel failed: fatal: not a git repository')\ncd /tmp && bun run codex:dev -- status\n// after\ncd /path/to/repo && bun run codex:dev -- status","handlingStrategy":"validation","validationCode":"// Confirm you are in a healthy git repo before running the dev tooling\nconst r = Bun.spawnSync([\"git\", \"rev-parse\", \"--git-dir\"])\nif (r.exitCode !== 0) throw new Error(\"Not inside a git repository; cd into the checkout first\")","typeGuard":null,"tryCatchPattern":"try {\n  await devScript()\n} catch (e) {\n  if (e instanceof Error && / failed: /.test(e.message)) {\n    // message carries the exact command and git stderr\n    console.error(`Git step failed:\\n${e.message}`)\n  } else throw e\n}","preventionTips":["Run dev tooling from inside the repository checkout, not an arbitrary cwd.","Add safe.directory entries when repos change ownership (containers, sudo).","Check `git status` sanity before long dev workflows.","Keep git installed and on PATH in CI/dev containers."],"tags":["git","dev-tooling","subprocess"],"backgroundTag":"git-command-failed","analyzedSha":"c9c10f8c75412c7232cb2bd663e5fd1cea98d84e","analyzedAt":"2026-08-31T15:18:07.959Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}