{"record":{"id":"c71916c7886c631d","repo":"deepseek-ai/deepseek-harness","slug":"agent-ownerid-is-not-the-registered-agent-ins","errorCode":null,"errorMessage":"agent \"${ownerId}\" is not the registered agent instance (background job owner must be live)","messagePattern":"agent \"(.+?)\" is not the registered agent instance \\(background job owner must be live\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jobs/jobs-local/src/index.ts","lineNumber":455,"sourceCode":"        this.selfCtx.logger.warn(`jobs: onJobDone listener threw for ${job.id}: ${String(error)}`)\n      }\n    }\n  }\n\n  /**\n   * Attach one awaited cleanup through the exact owner's scope. This survives\n   * producer reloads and joins agent quiescence; the retained disposer lets\n   * service teardown detach the cross-fiber effect. Fails when the registry is\n   * absent or the owner is not its currently registered instance.\n   */\n  private ensureOwnerCleanup(owner: Agent): void {\n    const ownerId = owner.id\n    const agents = this.selfCtx.get('agents')\n    if (agents === undefined) {\n      throw new Error('background job ownership requires the agent registry (load @deepseek-ai/dsh-agent)')\n    }\n    if (agents.get(ownerId) !== owner) {\n      throw new Error(`agent \"${ownerId}\" is not the registered agent instance (background job owner must be live)`)\n    }\n    if (this.ownerCleanups.has(owner)) return\n    // Record only after attach succeeds; a disposing scope rejects new effects.\n    const detach = owner.ctx.effect(() => async () => {\n      this.ownerCleanups.delete(owner)\n      await this.disposeOwned(owner)\n    }, 'jobs.ownerCleanup()')\n    this.ownerCleanups.set(owner, detach)\n  }\n\n  /** Cancel, await terminal records, and drop every job owned by one exact agent lifecycle. */\n  private async disposeOwned(owner: Agent): Promise<void> {\n    const owned = [...this.store.values()].filter(job => job.owner === owner)\n    this.cancelForTeardown(owned, 'owner disposed')\n    await Promise.all(owned.map(job => job.settled))\n    for (const job of owned) this.store.delete(job.id)\n    // Removal is the one visible-set change no per-job record carries, so it\n    // must be announced here or an observer keeps the dropped rows forever.","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/jobs/jobs-local/src/index.ts#L437-L473","documentation":"Error \"agent \"${ownerId}\" is not the registered agent instance (background job owner must be live)\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/jobs/jobs-local/src/index.ts:455 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Start the job from the live registered agent instance for that owner id."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}