{"record":{"id":"c439fc8df07a8959","repo":"deepseek-ai/deepseek-harness","slug":"no-agent-factory-registered-load-an-agent-loop-pl","errorCode":null,"errorMessage":"no agent factory registered (load an agent-loop plugin)","messagePattern":"no agent factory registered \\(load an agent-loop plugin\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/agent/src/index.ts","lineNumber":392,"sourceCode":"      if (this.factory !== undefined) throw new Error('an agent factory is already registered')\n      // Avoid stacking two Cordis shadow layers when a caller passes a Service\n      // already read through a context. Calls are re-traced through their\n      // actual owner context below.\n      const target = (factory as AgentFactory & { [symbols.original]?: AgentFactory })[symbols.original] ?? factory\n      this.factory = { target }\n      return () => { this.factory = undefined }\n    }, 'agents.setFactory()')\n    // The exact cordis effect disposer (the agents.register() convention): a\n    // caller's composite effect can yield it for in-order teardown; the\n    // loop's constructor effect returns it directly, identity-nesting the\n    // registration under that effect.\n    // oxlint-disable-next-line typescript/no-misused-promises -- synchronous cleanup; direct return preserves disposer identity\n    return dispose\n  }\n\n  /** Return the active creation factory. */\n  private requireFactory(): FactorySlot {\n    if (this.factory === undefined) throw new Error(NO_FACTORY_MESSAGE)\n    return this.factory\n  }\n\n  /**\n   * Create and publish a new agent through the registered factory.\n   * Distinct from {@link register} (which records an already-constructed\n   * agent): this constructs the agent and its session. Rejects if no factory is\n   * registered or creation/setup fails. The resolved {@link AgentHandle} lets\n   * the owner tear down exactly this agent.\n   * @param options - shared identity, session seed/metadata, and agent options.\n   * @returns the handle after setup, rollback-covered publication, and loop start complete.\n   */\n  async create(options: CreateAgentOptions): Promise<AgentHandle> {\n    const ownerCtx = this.ctx\n    // Re-trace a Service-backed factory through the accessing context\n    // explicitly. This preserves AgentLoop's dependency origin while binding\n    // its effects to ownerCtx; plain factories receive ownerCtx as an explicit\n    // capability and need no Cordis tracker magic.","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/agent/src/index.ts#L374-L410","documentation":"Error \"no agent factory registered (load an agent-loop plugin)\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/agent/src/index.ts:392 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Load an agent-loop plugin so an agent factory is registered."],"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"}