{"record":{"id":"ffbb6bce217377b5","repo":"coleam00/Archon","slug":"project-projectname-could-not-be-updated-it","errorCode":null,"errorMessage":"Project \"${projectName}\" could not be updated — it appears to have been removed. Use /register-project to re-create it.","messagePattern":"Project \"(.+?)\" could not be updated — it appears to have been removed\\. Use /register-project to re-create it\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/orchestrator/orchestrator-agent.ts","lineNumber":3462,"sourceCode":"  }\n\n  // Find existing codebase by name\n  const existing = await codebaseDb.listCodebases();\n  const codebase = existing.find(c => c.name.toLowerCase() === projectName.toLowerCase());\n\n  if (!codebase) {\n    return `Project \"${projectName}\" not found. Use /register-project to create it.`;\n  }\n\n  try {\n    await codebaseDb.updateCodebase(codebase.id, { default_cwd: newPath });\n  } catch (err) {\n    getLog().warn({ err: err as Error, codebaseId: codebase.id, newPath }, 'project.update_failed');\n    // Row gone (deleted between the fetch above and the UPDATE) is the only\n    // case where \"removed\" is the honest answer; anything else is an\n    // operational DB failure and should say so instead of blaming data state.\n    if (err instanceof codebaseDb.CodebaseNotFoundError) {\n      return `Project \"${projectName}\" could not be updated — it appears to have been removed. Use /register-project to re-create it.`;\n    }\n    return `Project \"${projectName}\" could not be updated — database error. Please try again.`;\n  }\n  getLog().info(\n    { name: projectName, oldPath: codebase.default_cwd, newPath, id: codebase.id },\n    'project.update_completed'\n  );\n  return `Project \"${projectName}\" updated.\\nOld path: ${codebase.default_cwd}\\nNew path: ${newPath}`;\n}\n\n/**\n * Handle /remove-project command.\n * Deletes a registered project from the database.\n */\nasync function handleRemoveProject(message: string): Promise<string> {\n  const { args } = commandHandler.parseCommand(message);\n  if (args.length < 1) {\n    return 'Usage: /remove-project <name>';","sourceCodeStart":3444,"sourceCodeEnd":3480,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/orchestrator/orchestrator-agent.ts#L3444-L3480","documentation":"Returned when updating a project's path fails because the project row no longer exists: CodebaseNotFoundError was thrown, meaning the codebase was deleted between the initial fetch and the UPDATE (logged as project.update_failed). The message directs the user to re-register the project with /register-project; this is deliberately the only case labeled 'removed' — DB operational errors get a different message.","triggerScenarios":"An orchestrator command (via the orchestrator agent) moves/updates a project's default_cwd while, concurrently, the codebase row is deleted (unregister-project, another operator, or a cleanup job), so the UPDATE hits a missing row.","commonSituations":"Two operators managing the same project simultaneously; a cleanup/unregister workflow racing a path update; deleting the project in another session while an update is in flight.","solutions":["Re-create the project with `/register-project` pointing at the new path.","Confirm the project was intentionally removed (`/list-projects` or equivalent) before re-registering.","Coordinate with other operators to avoid concurrent register/unregister and update operations on the same project."],"exampleFix":"// before\n/update-project myapp /new/path   # row deleted mid-update\n// after\n/register-project myapp /new/path","handlingStrategy":"try-catch","validationCode":"// Before updating, re-fetch and confirm the row still exists:\nconst codebase = await codebaseDb.getCodebaseById(id);\nif (!codebase) console.warn(`Project '${name}' was removed; re-register with /register-project`);","typeGuard":null,"tryCatchPattern":"try {\n  await updateProjectPath(id, newPath);\n} catch (err) {\n  if (err instanceof codebaseDb.CodebaseNotFoundError) {\n    console.warn(`Project removed — re-register it with /register-project at ${newPath}`);\n  } else throw err;\n}","preventionTips":["Avoid concurrent unregister/unregister-style operations on the same project.","Re-fetch the project immediately before mutating it.","Use /list-projects to confirm the project exists before path updates.","Coordinate project management across operators/sessions."],"tags":["database","project","race-condition"],"backgroundTag":"record-not-found-on-update","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}