dagger/dagger · error
workspace owner client metadata not initialized
Error message
workspace owner client metadata not initialized
What it means
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.
Source
Thrown at engine/server/session.go:2360
sess.lockFiles[key] = state
return state, nil
}
func (srv *Server) workspaceOwnerAccess(
ctx context.Context,
sess *daggerSession,
ws *core.Workspace,
) (context.Context, *engineutil.Client, error) {
if ws.ClientID == "" {
return nil, nil, fmt.Errorf("workspace has no client ID")
}
ownerClient, err := srv.clientFromIDs(sess.sessionID, ws.ClientID)
if err != nil {
return nil, nil, fmt.Errorf("workspace owner client: %w", err)
}
if ownerClient.clientMetadata == nil {
return nil, nil, fmt.Errorf("workspace owner client metadata not initialized")
}
if ownerClient.engineUtilClient == nil {
return nil, nil, fmt.Errorf("workspace owner buildkit client not initialized")
}
workspaceCtx := engine.ContextWithClientMetadata(ctx, ownerClient.clientMetadata)
return workspaceCtx, ownerClient.engineUtilClient, nil
}
func workspaceLockPath(ws *core.Workspace) (string, error) {
if ws == nil {
return "", fmt.Errorf("workspace is required")
}
if ws.HostPath() == "" {
return "", fmt.Errorf("workspace has no host path")
}
if ws.LockFile == "" {
return "", fmt.Errorf("workspace lockfile is not selected")View on GitHub (pinned to 82ba2681db)
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
Defensive patterns
Strategy: type-guard
Validate before calling
if ownerClient == nil || ownerClient.clientMetadata == nil {
return errors.New("owner client not fully initialized")
} Type guard
func ownerReady(c *daggerClient) bool {
return c != nil && c.clientMetadata != nil && c.engineUtilClient != nil
} Try / catch
if err != nil && strings.Contains(err.Error(), "client metadata not initialized") {
return fmt.Errorf("recreate the client session: %w", err)
} Prevention
- 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
When it happens
Trigger: clientFromIDs returned a daggerClient whose clientMetadata was never initialized — an incompletely initialized or torn-down client is used for workspaceOwnerAccess.
Common situations: Race during client shutdown/teardown; client constructed through a path that skips metadata setup; internal state corruption after reconnect.
Related errors
- failed to get main client caller ID: %w
- ensure workspace modules: %w
- workspace has no client ID
- package name is empty
- attach bound workspace: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/f472d55f323ec097.
Report an issue: GitHub.