{"record":{"id":"5347250fceb71a4a","repo":"can1357/oh-my-pi","slug":"unknown-security-scan-plan-input-planid","errorCode":null,"errorMessage":"Unknown security scan plan: ${input.planId}","messagePattern":"Unknown security scan plan: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/security/coordinator.ts","lineNumber":467,"sourceCode":"\t\t\t\taccount,\n\t\t\t\tconfig: securityConfigSnapshot(this.#host.settings),\n\t\t\t\tworkflowFingerprint: SECURITY_WORKFLOW_FINGERPRINT,\n\t\t\t\tsignal: input.signal,\n\t\t\t},\n\t\t\tthis.#gitAdapter,\n\t\t);\n\t\tawait store.putPlan(plan);\n\t\treturn plan;\n\t}\n\n\tasync start(input: SecurityStartInput): Promise<SecurityOperationSnapshot> {\n\t\tif (!this.#host.settings.get(\"security.enabled\")) {\n\t\t\tthrow new Error(\"Security is disabled; enable security.enabled before starting a scan\");\n\t\t}\n\t\tawait this.#ensureRecovered();\n\t\tconst store = await this.#openStore(this.#host.cwd);\n\t\tconst plan = await store.getPlan(input.planId);\n\t\tif (!plan) throw new Error(`Unknown security scan plan: ${input.planId}`);\n\t\tawait assertSecurityScanPlanFresh(\n\t\t\tplan,\n\t\t\t{\n\t\t\t\tconfig: securityConfigSnapshot(this.#host.settings),\n\t\t\t\tworkflowFingerprint: SECURITY_WORKFLOW_FINGERPRINT,\n\t\t\t},\n\t\t\tthis.#gitAdapter,\n\t\t);\n\t\tconst operationId = this.#createOperationId();\n\t\tconst scanId = createSecurityScanId();\n\t\tconst createdAt = toIsoTimestamp(this.#now);\n\t\tconst snapshot: SecurityOperationSnapshot = {\n\t\t\toperationId,\n\t\t\tplanId: plan.id,\n\t\t\tscanId,\n\t\t\tphase: \"queued\",\n\t\t\tcreatedAt,\n\t\t\tupdatedAt: createdAt,","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/security/coordinator.ts#L449-L485","documentation":"start() looks up the plan by id in the security store for the current working directory. If store.getPlan(planId) returns null the plan doesn't exist (or isn't in this store), so the coordinator throws with the offending id. Plans are persisted by preflight() into a project-scoped store.","triggerScenarios":"Calling start() with a planId that was never created, already consumed/deleted, or created by a preflight in a different repository/cwd so a different store is opened; typos in a plan id copied from logs.","commonSituations":"Re-running automation against an expired or pruned plan store; switching project directories between preflight and start; using a plan id from another machine or session.","solutions":["Run coordinator.preflight() again to create a fresh plan, and use the returned plan.id for start().","Confirm the plan id exists in the store for the exact cwd passed to the coordinator — match the working directory used at preflight time.","Check for stale/expired plans: plans go through assertSecurityScanPlanFresh after lookup, so regenerate rather than reusing old ids.","Verify you didn't truncate or clean the security store directory between planning and start."],"exampleFix":"// before\nawait coordinator.start({ planId: rememberedPlanId }); // may be gone\n// after\nconst plan = await coordinator.preflight();\nawait coordinator.start({ planId: plan.id });","handlingStrategy":"validation","validationCode":"const store = await SecurityStore.openForCwd(coordinatorCwd);\nif (!(await store.getPlan(planId))) throw new Error(`plan ${planId} not found in store for ${coordinatorCwd}`);","typeGuard":null,"tryCatchPattern":"try {\n  await coordinator.start({ planId });\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Unknown security scan plan\")) {\n    const plan = await coordinator.preflight();\n    await coordinator.start({ planId: plan.id });\n  } else throw err;\n}","preventionTips":["Always chain preflight → start with the plan object returned by preflight, never a remembered id.","Keep cwd consistent between planning and starting; the store is project-scoped.","Don't reuse plan ids across sessions, machines, or after store cleanup."],"tags":["state","stale-reference","security-scan"],"backgroundTag":"entity-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}