{"record":{"id":"90b306c86b2fe4f6","repo":"paperclipai/paperclip","slug":"creator-run-invalid","errorCode":"creator_run_invalid","errorMessage":"createdByRunId is not valid for this watchdog decision actor","messagePattern":"createdByRunId is not valid for this watchdog decision actor","errorType":"error_code","errorClass":"WatchdogDecisionApplicationError","httpStatus":null,"severity":"error","filePath":"server/src/modules/active-run-watchdog/application/use-cases.ts","lineNumber":188,"sourceCode":"      evaluationIssue.originKind !== STALE_ACTIVE_RUN_EVALUATION_ORIGIN_KIND ||\n      evaluationIssue.originId !== run.id\n    )) {\n      throw new WatchdogDecisionApplicationError(\n        \"evaluation_issue_mismatch\",\n        \"Watchdog decision evaluation issue is not bound to the target run\",\n      );\n    }\n\n    const createdByRunId = input.actor.type === \"agent\"\n      ? input.actor.runId ?? input.createdByRunId ?? null\n      : input.actor.type === \"board\"\n        ? input.actor.runId ?? input.createdByRunId ?? null\n        : null;\n    if (createdByRunId) {\n      const creatorRun = await deps.reader.findRunForCompany(input.companyId, createdByRunId);\n      const sameAgent = input.actor.type !== \"agent\" || creatorRun?.agentId === input.actor.agentId;\n      if (!creatorRun || !sameAgent) {\n        throw new WatchdogDecisionApplicationError(\n          \"creator_run_invalid\",\n          \"createdByRunId is not valid for this watchdog decision actor\",\n        );\n      }\n    }\n\n    const decisionNow = input.now ?? new Date();\n    const effectiveSnoozedUntil = input.decision === \"snooze\"\n      ? input.snoozedUntil ?? null\n      : input.decision === \"continue\"\n        ? input.snoozedUntil && input.snoozedUntil > decisionNow\n          ? input.snoozedUntil\n          : new Date(decisionNow.getTime() + deps.continueRearmMs)\n        : null;\n\n    return deps.writer.recordDecision(input.companyId, {\n      runId: run.id,\n      actor: input.actor,","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/modules/active-run-watchdog/application/use-cases.ts#L170-L206","documentation":"WatchdogDecisionApplicationError with code creator_run_invalid, raised when a watchdog decision supplies a createdByRunId (or actor.runId) that does not resolve to a run in the same company, or an agent actor claims a creator run owned by a different agent. It validates the actor's authority to act on behalf of the creator run.","triggerScenarios":"Calling recordWatchdogDecision with createdByRunId of a deleted run, a run from another company, or a run whose agentId differs from actor.agentId for an agent actor.","commonSituations":"Stale run id cached by an agent after the run was deleted; company id mismatch in multi-tenant calls; agent attempting to attribute decisions to another agent's run.","solutions":["Verify the run exists in the same company via GET for the run before submitting the decision","Ensure actor.runId / createdByRunId refers to a run owned by the acting agent","Omit createdByRunId if there is no valid creator run","Re-fetch fresh run identity after restarts instead of reusing persisted ids"],"exampleFix":"// before\nrecordWatchdogDecision({ companyId, actor: { type: 'agent', agentId }, createdByRunId: staleRunId });\n// after\nconst run = await getRun(companyId, runId);\nif (run && run.agentId === agentId) {\n  recordWatchdogDecision({ companyId, actor: { type: 'agent', agentId }, createdByRunId: run.id });\n}","handlingStrategy":"validation","validationCode":"const run = await getRun(companyId, createdByRunId);\nif (!run || run.companyId !== companyId || run.agentId !== actor.agentId) throw new Error('invalid creator run');","typeGuard":"const validCreator = (r, actor) => !!r && r.companyId === actor.companyId && (actor.type !== 'agent' || r.agentId === actor.agentId);","tryCatchPattern":"try { await recordWatchdogDecision(input) } catch (e) { if (e.code === 'creator_run_invalid') { /* drop or re-attribute decision */ } else throw e; }","preventionTips":["Always re-fetch run identity before attributing decisions after process restarts","Never cache createdByRunId across company switches","Ensure agent actors pass their own agentId consistent with the creator run","Omit createdByRunId when the creator run may have been pruned"],"tags":["watchdog","authorization","run"],"backgroundTag":"entity-not-found","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}