{"record":{"id":"3473a6959537e209","repo":"paperclipai/paperclip","slug":"label-does-not-exist-at-resolved","errorCode":null,"errorMessage":"${label} does not exist at ${resolved}.","messagePattern":"(.+?) does not exist at (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/src/worktree-seed-source.ts","lineNumber":103,"sourceCode":"  if (configDirEntry?.isSymbolicLink()) {\n    try {\n      statSync(configDir);\n    } catch (error) {\n      throw new Error(\n        `Registered base project workspace Paperclip config at ${configPath} cannot be inspected (${errorCode(error)} on its .paperclip symlink target).`,\n      );\n    }\n  }\n  return false;\n}\n\nfunction canonicalRegularFile(filePath: string, label: string): string {\n  const resolved = path.resolve(filePath);\n  let canonical: string;\n  try {\n    canonical = realpathSync(resolved);\n  } catch {\n    throw new Error(`${label} does not exist at ${resolved}.`);\n  }\n  if (canonical !== resolved || lstatSync(resolved).isSymbolicLink()) {\n    throw new Error(`${label} must be a canonical path and cannot use a symlink alias.`);\n  }\n  if (!lstatSync(canonical).isFile()) {\n    throw new Error(`${label} is not a regular file at ${canonical}.`);\n  }\n  return canonical;\n}\n\n/** Resolve the authoritative source and target identities without consulting diagnostics. */\nexport function resolveRegisteredWorktreeSeedSource(\n  input: RegisteredWorktreeSeedSourceInput,\n): CanonicalWorktreeSeedSource {\n  const registeredCwd = input.registeredBaseWorkspaceCwd?.trim();\n  const explicitSource = input.explicitSourceConfigPath?.trim();\n  if (!registeredCwd && !explicitSource) {\n    throw new Error(","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/packages/shared/src/worktree-seed-source.ts#L85-L121","documentation":"canonicalRegularFile() runs realpathSync on a config path and the call throws, meaning nothing exists at that resolved path. This fires for the registered source config, the explicit (--from-config) source, the target worktree config, or the manifest diagnostic path, with `${label}` naming which one is missing.","triggerScenarios":"resolveRegisteredWorktreeSeedSource with a registered/explicit source path whose file was deleted; a target worktree invoked before its `.paperclip/config.json` was created; a manifest whose diagnostic configPath points at a nonexistent file.","commonSituations":"Target worktree config not yet seeded; workspace or instance directory moved after registration; typo in --from-config; config removed by a clean/reset step (`rm -rf data/`) while registration still points there.","solutions":["Check which label failed (source vs target vs manifest diagnostic) and `ls` that exact resolved path.","Re-create the missing config.json (re-run the worktree/workspace init that generates it).","If the path is stale, update the registration or pass the correct --from-config path.","For a missing target config, ensure the target worktree bootstrap runs before source resolution."],"exampleFix":"# before\npaperclip worktree seed --from-config ./wrong/path/config.json  # ENOENT\n\n# after\npaperclip worktree seed --from-config \"$HOME/.paperclip/instances/<id>/config.json\"","handlingStrategy":"validation","validationCode":"import { existsSync, realpathSync } from \"node:fs\";\n\nfunction configExists(p: string): boolean {\n  try { return existsSync(realpathSync(p)); } catch { return false; }\n}\n\n// before resolving:\nif (!configExists(sourcePath) || !configExists(targetConfigPath)) {\n  throw new Error(\"seed configs missing — re-run worktree init\");\n}","typeGuard":"import { statSync } from \"node:fs\";\nconst isReadableFile = (p: string): p is string => {\n  try { return statSync(p).isFile(); } catch { return false; }\n};","tryCatchPattern":"try {\n  return resolveRegisteredWorktreeSeedSource(input);\n} catch (e) {\n  if (e instanceof Error && /does not exist at/.test(e.message)) {\n    return null; // caller decides: re-init worktree or prompt for --from-config\n  }\n  throw e;\n}","preventionTips":["Create the target worktree config before invoking seed resolution.","Run resolution immediately after registration while paths are fresh.","Wrap resolution in a preflight that stats every config path you will pass."],"tags":["filesystem","config","worktree-seed","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-21T17:58:32.592Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}