{"record":{"id":"f5901cc223fb8e25","repo":"vercel/ai","slug":"the-deepagents-harness-cannot-use-mintbridgetoken","errorCode":null,"errorMessage":"The deepagents harness cannot use `mintBridgeToken` with a sandbox session that does not expose an id.","messagePattern":"The deepagents harness cannot use `mintBridgeToken` with a sandbox session that does not expose an id\\.","errorType":"exception","errorClass":"HarnessCapabilityUnsupportedError","httpStatus":null,"severity":"error","filePath":"packages/harness-deepagents/src/deepagents-harness.ts","lineNumber":236,"sourceCode":"    harnessId: 'deepagents',\n    builtinTools: DEEPAGENTS_BUILTIN_TOOLS,\n    // Built-in tool approvals are gated in-bridge via DeepAgents' interruptOn (HITL) middleware.\n    supportsBuiltinToolApprovals: true,\n    lifecycleStateSchema: deepAgentsResumeStateSchema,\n    getBootstrap: getDeepAgentsBootstrap,\n    doStart: async startOpts => {\n      const permissionMode = startOpts.permissionMode;\n      const sandboxSession = startOpts.sandboxSession;\n      const toolSafeSandboxSession =\n        getRestrictedSandboxSession(sandboxSession);\n      const sandboxId = 'id' in sandboxSession ? sandboxSession.id : undefined;\n      validateBasicSandboxSettings({\n        sandboxSession,\n        port: settings.port,\n        portEndpoint: settings.portEndpoint,\n      });\n      if (settings.mintBridgeToken != null && sandboxId == null) {\n        throw new HarnessCapabilityUnsupportedError({\n          harnessId: 'deepagents',\n          message:\n            'The deepagents harness cannot use `mintBridgeToken` with a sandbox session that does not expose an id.',\n        });\n      }\n      const defaultWorkingDirectory =\n        await resolveSandboxDefaultWorkingDirectory({\n          sandboxSession,\n          abortSignal: startOpts.abortSignal,\n        });\n      const lifecycleState = startOpts.continueFrom ?? startOpts.resumeFrom;\n      const isResume = lifecycleState != null;\n      const isContinue = startOpts.continueFrom != null;\n      const resumeData =\n        isResume && typeof lifecycleState?.data === 'object'\n          ? (lifecycleState.data as {\n              bridge?: DeepAgentsBridgeCoords;\n              sandboxCredentialEnvironment?: Record<string, string>;","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-deepagents/src/deepagents-harness.ts#L218-L254","documentation":"`mintBridgeToken` requires the sandbox session to expose an `id`, because bridge tokens are minted per sandbox identity for reattachment. When the configured `mintBridgeToken` function is present but the sandbox session object has no `id` property, `createDeepAgents` throws `HarnessCapabilityUnsupportedError` at start rather than failing later during token minting.","triggerScenarios":"Calling `createDeepAgents({ mintBridgeToken: fn })` and starting the harness with a `sandboxSession` object that lacks an `id` field (custom or minimal sandbox session implementations).","commonSituations":"Using a custom sandbox provider that doesn't surface session ids; constructing a sandbox session manually for tests without an `id`; a provider SDK version whose session type dropped or renamed `id`.","solutions":["Use a sandbox session that exposes a stable `id` property (e.g. the provider's native session object).","Remove the `mintBridgeToken` option if your sandbox cannot provide an id and you don't need authenticated bridge reattachment.","Update the sandbox provider SDK if a newer version exposes session ids.","Wrap the session to supply an id if your infrastructure can derive one (only if it's stable across reattach)."],"exampleFix":"// before\ncreateDeepAgents({ mintBridgeToken: mintToken }) // session without id\n// after\nconst session = await createSandboxSession(); // ensure { id } is present\ncreateDeepAgents({ mintBridgeToken: mintToken }) // or drop mintBridgeToken","handlingStrategy":"validation","validationCode":"if (settings.mintBridgeToken != null && !('id' in sandboxSession)) {\n  throw new Error('mintBridgeToken requires a sandbox session with an id');\n}","typeGuard":"function hasSandboxId(s: object): s is { id: string } {\n  return 'id' in s && typeof (s as { id?: unknown }).id === 'string';\n}","tryCatchPattern":"try {\n  await harness.start(opts);\n} catch (error) {\n  if (error instanceof HarnessCapabilityUnsupportedError && error.message.includes('mintBridgeToken')) {\n    // drop mintBridgeToken or switch to an id-bearing sandbox session\n  }\n  throw error;\n}","preventionTips":["Use sandbox providers whose sessions expose a stable `id`","Only set mintBridgeToken when the session type includes `id`","Type your sandbox session as having `{ id: string }` when using token minting"],"tags":["sandbox","capability","configuration"],"backgroundTag":"capability-unsupported","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}