{"record":{"id":"57422af8da4c18b9","repo":"dagger/dagger","slug":"client-q-already-exists-with-different-host-servi","errorCode":null,"errorMessage":"client %q already exists with different host service proxy client %q","messagePattern":"client %q already exists with different host service proxy client %q","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"engine/server/session.go","lineNumber":1329,"sourceCode":"\t\t\treturn nil, nil, fmt.Errorf(\"client %q already exists with different secret token\", clientID)\n\t\t}\n\n\t\t// for nested clients running the dagger cli, the session attachable\n\t\t// connection may not have all of the client metadata yet, so we\n\t\t// fill in some missing fields here that may be set later by the cli\n\t\tif client.clientMetadata.AllowedLLMModules == nil {\n\t\t\tclient.clientMetadata.AllowedLLMModules = opts.AllowedLLMModules\n\t\t}\n\t\tif opts.LoadWorkspaceModules {\n\t\t\tclient.clientMetadata.LoadWorkspaceModules = true\n\t\t}\n\t\tif opts.HostServiceProxyClientID != \"\" {\n\t\t\tswitch client.hostServiceProxyClientID {\n\t\t\tcase \"\":\n\t\t\t\tclient.hostServiceProxyClientID = opts.HostServiceProxyClientID\n\t\t\tcase opts.HostServiceProxyClientID:\n\t\t\tdefault:\n\t\t\t\treturn nil, nil, fmt.Errorf(\"client %q already exists with different host service proxy client %q\", clientID, client.hostServiceProxyClientID)\n\t\t\t}\n\t\t}\n\t\tif opts.SingleQuery {\n\t\t\tclient.clientMetadata.SingleQuery = true\n\t\t}\n\t\tif client.clientMetadata.WorkspaceModuleScope == \"\" {\n\t\t\tclient.clientMetadata.WorkspaceModuleScope = opts.WorkspaceModuleScope\n\t\t}\n\t\tif opts.SuppressCompatWorkspaceWarning {\n\t\t\tclient.clientMetadata.SuppressCompatWorkspaceWarning = true\n\t\t}\n\t\tif client.clientMetadata.Workspace == nil && !client.workspaceLoaded {\n\t\t\tif workspaceRef, ok := workspaceRefFromClientMetadata(opts.ClientMetadata); ok {\n\t\t\t\tref := workspaceRef\n\t\t\t\tclient.clientMetadata.Workspace = &ref\n\t\t\t}\n\t\t}\n\t\tif client.clientMetadata.WorkspaceEnv == nil && !client.workspaceLoaded {","sourceCodeStart":1311,"sourceCodeEnd":1347,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/server/session.go#L1311-L1347","documentation":"When an existing initialized client is reattached with a HostServiceProxyClientID that differs from the one already recorded, the server rejects the request. A client's host-service proxy binding must be stable; conflicting bindings would misroute host service traffic (e.g. secret socket access). An empty stored value is back-filled instead of erroring.","triggerScenarios":"Calling getOrInitClient for an existing client where opts.HostServiceProxyClientID is non-empty and != client.hostServiceProxyClientID (stored value also non-empty).","commonSituations":"A nested exec reuses a parent's client ID but carries its own proxy client ID; misconfigured proxy wiring in module function calls; replayed requests through a different proxy.","solutions":["Ensure each client ID consistently maps to one host-service proxy client","Use a distinct client ID for connections that use a different proxy","Check nested client metadata propagation so the original proxy client ID is preserved"],"exampleFix":"// before\nreconnect(existingClientID, newProxyClientID)\n// after\nreconnect(newClientID, newProxyClientID)","handlingStrategy":"validation","validationCode":"// ensure proxy client ID is derived from the same client identity\nif existingProxyID != \"\" && newProxyID != existingProxyID {\n    clientID = newClientID() // use a fresh client ID for a different proxy\n}","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"different host service proxy client\") {\n    clientID = newClientID(); reconnect(clientID, proxyID)\n}","preventionTips":["Keep a 1:1 mapping between client ID and proxy client ID","Preserve the original proxy client ID through nested execs","Don't reuse a parent's client ID from a differently-proxied subprocess"],"tags":["client","proxy","host-service"],"backgroundTag":"proxy-client-id-conflict","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}