{"record":{"id":"262dc66f71646875","repo":"paperclipai/paperclip","slug":"config-not-found-at-configpath-262dc6","errorCode":null,"errorMessage":"Config not found at ${configPath}.","messagePattern":"Config not found at (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":428,"sourceCode":"      assertStorageCompanyPrefix(companyId, objectKey);\n      const { sdk, client } = await getS3Client();\n      await client.send(\n        new sdk.PutObjectCommand({\n          Bucket: bucket,\n          Key: buildS3ObjectKey(prefix, objectKey),\n          Body: body,\n          ContentType: contentType,\n          ContentLength: body.length,\n        }),\n      );\n    },\n  };\n}\n\nfunction openConfiguredStorage(configPath: string): ConfiguredStorage {\n  const config = readConfig(configPath);\n  if (!config) {\n    throw new Error(`Config not found at ${configPath}.`);\n  }\n  return createConfiguredStorageFromPaperclipConfig(config);\n}\n\nasync function streamToBuffer(stream: NodeJS.ReadableStream): Promise<Buffer> {\n  const chunks: Buffer[] = [];\n  for await (const chunk of stream) {\n    chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n  }\n  return Buffer.concat(chunks);\n}\n\nexport function isMissingStorageObjectError(error: unknown): boolean {\n  if (!error || typeof error !== \"object\") return false;\n  const candidate = error as { code?: unknown; status?: unknown; name?: unknown; message?: unknown };\n  return candidate.code === \"ENOENT\"\n    || candidate.status === 404\n    || candidate.name === \"NoSuchKey\"","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L410-L446","documentation":"Thrown by openConfiguredStorage when readConfig(configPath) returns a falsy value, meaning no readable Paperclip config file exists at the given path. The worktree storage command requires a valid config to construct the storage backend and refuses to proceed with an undefined config.","triggerScenarios":"Invoking a worktree storage subcommand with --config pointing at a path that does not exist or is not a Paperclip config JSON; running from a directory with no .paperclip/config.json and no PAPERCLIP_CONFIG env; passing a relative path that resolves against an unexpected cwd.","commonSituations":"Worktree was never initialized (paperclipai worktree init not run); config.json deleted or never copied; wrong --config flag value; running the storage command from the repo root instead of the worktree directory; HOME/data-dir misconfiguration.","solutions":["Run `paperclipai worktree init` (or the equivalent init) in the target worktree to generate .paperclip/config.json.","Pass an explicit --config path that points to an existing .paperclip/config.json.","Verify the path exists with ls/stat before invoking the command.","Set PAPERCLIP_CONFIG or run the command from inside the worktree root."],"exampleFix":"// before\nopenConfiguredStorage('/wrong/path/config.json')\n// after\nconst configPath = path.resolve(worktreeRoot, '.paperclip', 'config.json');\nif (!fs.existsSync(configPath)) throw new Error('Run `paperclipai worktree init` first.');\nopenConfiguredStorage(configPath);","handlingStrategy":"validation","validationCode":"function configExists(configPath: string): boolean {\n  return fs.existsSync(configPath) && Boolean(JSON.parse(fs.readFileSync(configPath, 'utf8') ?? 'null'));\n}","typeGuard":"function isReadableConfig(configPath: string): configPath is string {\n  try { return Boolean(readConfig(configPath)); } catch { return false; }\n}","tryCatchPattern":"if (!fs.existsSync(configPath)) {\n  console.error('Run `paperclipai worktree init` first; no config at', configPath);\n  process.exit(1);\n}\ntry { openConfiguredStorage(configPath); } catch (e) { /* surface message */ }","preventionTips":["Run worktree init before any storage command.","Pass --config explicitly and stat it first.","Set PAPERCLIP_CONFIG in worktree shell rc files."],"tags":["config","storage","worktree","missing-file"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}