deepseek-ai/deepseek-harness · warning

fork child rename failed: ${renamed.error.code}: ${renamed.e

Error message

fork child rename failed: ${renamed.error.code}: ${renamed.error.message}

What it means

The fork RPC succeeded and the child session exists, but the follow-up step — renaming the child to the increased fork title derived from the source title — returned a failed Result, so fork() throws instead of returning the child id. The thrown error embeds the rename RpcError's code and message. This is a partial failure: the child session is created and usable; only the automatic title bump was lost, and the caller loses the return value unless it preallocated the child id.

Source

Thrown at packages/client/runtime/src/client/sessions/service.ts:529

  }): Promise<SessionId> {
    const sourceTitle = opts.increaseTitle
      ? this.list.getSnapshot().byId[opts.sessionId]?.title
      : undefined
    const result = await this.manager.fork({
      sessionId: opts.sessionId,
      // Flooring lands inside the anchor's own turn (every turn opens with a
      // turn/start), so the host's first-turn/end-at-or-after cut still ends
      // on that turn — never clipped back to the previous one.
      ...(opts.atSeq === undefined ? {} : { atSeq: Math.floor(opts.atSeq) }),
    })
    if (!result.ok) throw new SessionForkError(result.error, opts.sessionId)
    this.projectList()
    const childId = result.value.sessionId
    if (sourceTitle !== undefined) {
      const child = this.binding(childId)?.session
      if (child === undefined) throw new Error(`fork child "${childId}" is not locally addressable`)
      const renamed = await child.rename(increasedForkTitle(sourceTitle))
      if (!renamed.ok) throw new Error(`fork child rename failed: ${renamed.error.code}: ${renamed.error.message}`)
    }
    return childId
  }

  /**
   * Resolve an Agent-scoped context view (use-and-discard).
   * @param id - session id (the agent identity — 1:1 same axis).
   * @returns scoped ctx, or undefined for a session neither listed nor already scoped.
   */
  scope(id: SessionId): AgentContext | undefined {
    return this.resolve(id)?.ctx
  }

  /**
   * Read the Agent scope tag off a context. Service-method boundary: fetch
   * bundles must reach scope resolution through ctx.sessions — a cross-bundle
   * value import of the standalone helper would inline a second module
   * instance whose private tag Symbol never matches.

View on GitHub (pinned to b150a551b8)

Solutions

  1. Recover instead of retrying the fork: the child exists — find it by your preallocated sessionId (or as the newest session) and rename it manually or accept the default title
  2. Preallocate the child id via opts.sessionId so a rename failure never orphans the child
  3. Retry only the rename step once the host confirms the child session
  4. Report the embedded code and message — they name the rename refusal, not a fork problem

Example fix

// before
const childId = await sessions.fork(sourceId, { atSeq })

// after — preallocate so a failed title bump is recoverable
const sessionId = mintSessionId()
let childId: SessionId
try {
  childId = await sessions.fork(sourceId, { atSeq, sessionId })
} catch (error) {
  if (error instanceof Error && error.message.startsWith('fork child rename failed')) {
    childId = sessionId // fork succeeded; only the derived title was not applied
  } else {
    throw error
  }
}
Defensive patterns

Strategy: fallback

Try / catch

try {
  childId = await sessions.fork(sourceId, { atSeq, sessionId })
} catch (error) {
  if (error instanceof Error && error.message.startsWith('fork child rename failed')) {
    childId = sessionId // keep the preallocated id; rename later or accept the default title
  } else {
    throw error
  }
}

Prevention

When it happens

Trigger: await sessions.fork(sourceId, ...) where the source has a title (sourceTitle !== undefined triggers the rename), the freshly created child is locally addressable, but child.rename(increasedForkTitle(sourceTitle)) fails host-side — rename validation, a lock on the new session, or connection state changing between create and rename.

Common situations: Connection flapping or host load between the fork and rename calls; title validation rejecting the generated incremented title; concurrent operations grabbing the freshly created child.

Related errors


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/358fe5dac518186d. Report an issue: GitHub.