{"record":{"id":"cc9e8ff2c8d2e33e","repo":"paperclipai/paperclip","slug":"stage-not-found-on-pipeline-detail-key-opts","errorCode":null,"errorMessage":"Stage not found on pipeline ${detail.key}: ${opts.stage}","messagePattern":"Stage not found on pipeline (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/pipelines.ts","lineNumber":312,"sourceCode":"          title: opts.title ?? \"Pipeline guidance\",\n          body,\n        }), { json: ctx.json });\n      })),\n  );\n\n  addPipelineOptions(\n    pipelines\n      .command(\"set-automation\")\n      .description(\"Set a run_routine onEnter automation on a stage\")\n      .argument(\"<pipeline>\", \"Pipeline ID or key\")\n      .requiredOption(\"--stage <key>\", \"Stage key\")\n      .requiredOption(\"--routine <id>\", \"Routine ID\")\n      .option(\"--note <text>\", \"Automation note\")\n      .action((pipeline: string, opts: AutomationOptions) => withPipelineErrors(async () => {\n        const ctx = resolvePipelineContext(opts);\n        const detail = await getPipeline(ctx, pipeline);\n        const stage = detail.stages?.find((item) => item.key === opts.stage);\n        if (!stage) throw new Error(`Stage not found on pipeline ${detail.key}: ${opts.stage}`);\n        const config = {\n          ...(stage.config ?? {}),\n          onEnter: {\n            ...(asOptionalObject(stage.config?.onEnter) ?? {}),\n            type: \"run_routine\",\n            routineId: opts.routine,\n            ...(opts.note ? { note: opts.note } : {}),\n          },\n        };\n        printOutput(await ctx.api.patch(apiPath`/api/pipelines/${detail.id}/stages/${stage.id}`, { config }), { json: ctx.json });\n      })),\n  );\n\n  addPipelineOptions(\n    pipelines\n      .command(\"ingest\")\n      .description(\"Ingest one case into a pipeline\")\n      .argument(\"<pipeline>\", \"Pipeline ID or key\")","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/pipelines.ts#L294-L330","documentation":"The set-automation command looked up the pipeline detail and found no stage whose key equals the --stage option, so there is no stage to attach the routine automation to.","triggerScenarios":"Thrown at cli/src/commands/pipelines.ts:312 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["List the pipeline's stages and pass a valid stage name/key to --stage."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}