{"record":{"id":"f472d55f323ec097","repo":"dagger/dagger","slug":"workspace-owner-client-metadata-not-initialized","errorCode":null,"errorMessage":"workspace owner client metadata not initialized","messagePattern":"workspace owner client metadata not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/server/session.go","lineNumber":2360,"sourceCode":"\tsess.lockFiles[key] = state\n\treturn state, nil\n}\n\nfunc (srv *Server) workspaceOwnerAccess(\n\tctx context.Context,\n\tsess *daggerSession,\n\tws *core.Workspace,\n) (context.Context, *engineutil.Client, error) {\n\tif ws.ClientID == \"\" {\n\t\treturn nil, nil, fmt.Errorf(\"workspace has no client ID\")\n\t}\n\n\townerClient, err := srv.clientFromIDs(sess.sessionID, ws.ClientID)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"workspace owner client: %w\", err)\n\t}\n\tif ownerClient.clientMetadata == nil {\n\t\treturn nil, nil, fmt.Errorf(\"workspace owner client metadata not initialized\")\n\t}\n\tif ownerClient.engineUtilClient == nil {\n\t\treturn nil, nil, fmt.Errorf(\"workspace owner buildkit client not initialized\")\n\t}\n\n\tworkspaceCtx := engine.ContextWithClientMetadata(ctx, ownerClient.clientMetadata)\n\treturn workspaceCtx, ownerClient.engineUtilClient, nil\n}\n\nfunc workspaceLockPath(ws *core.Workspace) (string, error) {\n\tif ws == nil {\n\t\treturn \"\", fmt.Errorf(\"workspace is required\")\n\t}\n\tif ws.HostPath() == \"\" {\n\t\treturn \"\", fmt.Errorf(\"workspace has no host path\")\n\t}\n\tif ws.LockFile == \"\" {\n\t\treturn \"\", fmt.Errorf(\"workspace lockfile is not selected\")","sourceCodeStart":2342,"sourceCodeEnd":2378,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/server/session.go#L2342-L2378","documentation":"workspaceOwnerAccess resolved the workspace's owner client but its clientMetadata field is nil — the owner client exists in the session yet was never fully initialized (its init handshake did not complete). This is an engine-internal state inconsistency, not a user input problem.","triggerScenarios":"clientFromIDs returned a daggerClient whose clientMetadata was never initialized — an incompletely initialized or torn-down client is used for workspaceOwnerAccess.","commonSituations":"Race during client shutdown/teardown; client constructed through a path that skips metadata setup; internal state corruption after reconnect.","solutions":["Recreate the client/session (restart `dagger` session or function call)","Ensure calls go through the normal client initialization path that sets clientMetadata","If persistent, report — it signals internal initialization bug"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if ownerClient == nil || ownerClient.clientMetadata == nil {\n    return errors.New(\"owner client not fully initialized\")\n}","typeGuard":"func ownerReady(c *daggerClient) bool {\n    return c != nil && c.clientMetadata != nil && c.engineUtilClient != nil\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"client metadata not initialized\") {\n    return fmt.Errorf(\"recreate the client session: %w\", err)\n}","preventionTips":["Create clients only via the standard engine attach path","Avoid using clients mid-teardown","If reproducible, file an engine bug — this indicates internal init corruption"],"tags":["workspace","client-metadata","initialization"],"backgroundTag":"workspace-owner-metadata-missing","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"}