{"record":{"id":"8b16d714a2516042","repo":"EveryInc/compound-engineering-plugin","slug":"context-collectionpath-points-outside-a-compoun-8b16d7","errorCode":null,"errorMessage":"${context.collectionPath} points outside a Compound Engineering checkout; refusing to remove it","messagePattern":"(.+?) points outside a Compound Engineering checkout; refusing to remove it","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/dev/codex-dev.ts","lineNumber":425,"sourceCode":"): Promise<void> {\n  if (previous.kind === \"absent\") {\n    await removeManagedCollectionLink(context.collectionPath, activatedTarget, { ignoreChanges: true })\n    return\n  }\n  await replaceManagedCollectionLink(context.collectionPath, previous.target, {\n    kind: \"valid\",\n    target: activatedTarget,\n  })\n}\n\nexport async function removeLocalCollection(context: CodexDevContext): Promise<boolean> {\n  const state = await inspectLocalCollection(context)\n  if (state.kind === \"absent\") return false\n  if (state.kind === \"collision\") {\n    throw new Error(`${context.collectionPath} exists and is not a symlink; refusing to remove it`)\n  }\n  if (state.kind === \"unrelated\") {\n    throw new Error(`${context.collectionPath} points outside a Compound Engineering checkout; refusing to remove it`)\n  }\n  if (state.kind === \"broken\") {\n    throw new Error(`${context.collectionPath} is a broken symlink; refusing to remove it automatically`)\n  }\n  await removeManagedCollectionLink(context.collectionPath, state.target)\n  return true\n}\n\nfunction parseJson<T>(result: CommandResult, label: string): T {\n  try {\n    return JSON.parse(result.stdout) as T\n  } catch (error) {\n    throw new Error(`${label} returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`)\n  }\n}\n\nasync function runCodex(\n  context: CodexDevContext,","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/EveryInc/compound-engineering-plugin/blob/c9c10f8c75412c7232cb2bd663e5fd1cea98d84e/src/dev/codex-dev.ts#L407-L443","documentation":"removeLocalCollection() refuses to delete a symlink that resolves to a skills directory outside any Compound Engineering checkout ('unrelated' state). This prevents the tool from destroying a symlink owned by a different project or plugin that merely occupies the collection path.","triggerScenarios":"collectionPath is a symlink whose realpath does not pass assertCompoundEngineeringRepo(), or its basename is not 'skills' — e.g. it points at another repo's directory — and removeLocalCollection() (or switchToRemote / removeCodexDevInstallation) is called.","commonSituations":"The symlink was retargeted by hand or by another tool to a different checkout; the target repo's marker files were removed so it no longer registers as a Compound Engineering checkout; multiple plugins competing for the same skills path.","solutions":["Check the link target: `readlink <collectionPath>` and `realpath <collectionPath>`","If it is another tool's symlink, remove it manually with `rm <collectionPath>` after confirming","If it should be a Compound Engineering checkout, restore the missing repo marker files or point it at the correct checkout, then re-run","Use `bun run codex:dev -- status` to see the resolved state before deciding"],"exampleFix":"# before\n$ bun run codex:dev -- remote\n# Error: ... points outside a Compound Engineering checkout; refusing to remove it\n\n# after\n$ readlink /path/to/CODEX_HOME/skills/compound-engineering-local\n$ rm /path/to/CODEX_HOME/skills/compound-engineering-local  # verified as another tool's link\n$ bun run codex:dev -- remote","handlingStrategy":"validation","validationCode":"const state = await inspectLocalCollection(context);\nif (state.kind === \"unrelated\") {\n  console.log(`link targets ${state.resolvedTarget}; verify ownership before removing manually`);\n  return;\n}","typeGuard":"function isManagedLink(s: { kind: string }): boolean {\n  return s.kind === \"absent\" || s.kind === \"valid\" || s.kind === \"broken\";\n}","tryCatchPattern":"try {\n  await removeLocalCollection(context);\n} catch (e) {\n  if (String(e).includes(\"points outside\")) {\n    console.error(\"foreign symlink: inspect with readlink and remove manually only if it is yours\");\n  } else throw e;\n}","preventionTips":["Do not retarget the collection symlink to other repositories","Keep the Compound Engineering checkout marker files intact at the link target","Confirm a foreign link's owner before deleting it manually"],"tags":["filesystem","safety-guard","symlink","codex-dev"],"backgroundTag":"refusing-to-overwrite-existing-path","analyzedSha":"c9c10f8c75412c7232cb2bd663e5fd1cea98d84e","analyzedAt":"2026-08-31T15:18:07.959Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}