{"record":{"id":"615a372f32765589","repo":"paperclipai/paperclip","slug":"goal-not-found","errorCode":null,"errorMessage":"Goal not found","messagePattern":"Goal not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/src/routes/goals.ts","lineNumber":56,"sourceCode":"      action: \"goal.created\",\n      entityType: \"goal\",\n      entityId: goal.id,\n      details: { title: goal.title },\n    });\n    const telemetryClient = getTelemetryClient();\n    if (telemetryClient) {\n      trackGoalCreated(telemetryClient, { goalLevel: goal.level });\n    }\n    res.status(201).json(goal);\n  });\n\n  router.patch(\"/goals/:id\", validate(updateGoalSchema), async (req, res) => {\n    const id = req.params.id as string;\n    const existing = await getAccessibleResource(req, res, svc.getById(id), \"Goal not found\");\n    if (!existing) return;\n    const goal = await svc.update(id, req.body);\n    if (!goal) {\n      res.status(404).json({ error: \"Goal not found\" });\n      return;\n    }\n\n    const actor = getActorInfo(req);\n    await logActivity(db, {\n      companyId: goal.companyId,\n      actorType: actor.actorType,\n      actorId: actor.actorId,\n      agentId: actor.agentId,\n      action: \"goal.updated\",\n      entityType: \"goal\",\n      entityId: goal.id,\n      details: req.body,\n    });\n\n    res.json(goal);\n  });\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/routes/goals.ts#L38-L74","documentation":"Error \"Goal not found\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at server/src/routes/goals.ts:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the id in the request path or body refers to an existing record in this company; re-list the parent collection to get a valid id.","Check that the record was not deleted or archived, and that the request is scoped to the correct companyId."],"exampleFix":null,"handlingStrategy":null,"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-14T05:17:10.506Z"}