{"record":{"id":"f83f2aca36ad7990","repo":"dagger/dagger","slug":"source-socket-is-nil","errorCode":null,"errorMessage":"source socket is nil","messagePattern":"source socket is nil","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/schema/host.go","lineNumber":479,"sourceCode":"\tcache, err := dagql.EngineCache(ctx)\n\tif err != nil {\n\t\treturn inst, fmt.Errorf(\"failed to get dagql cache: %w\", err)\n\t}\n\n\tclientMetadata, err := engine.ClientMetadataFromContext(ctx)\n\tif err != nil {\n\t\treturn inst, fmt.Errorf(\"failed to get client metadata: %w\", err)\n\t}\n\n\tvar concreteSelf *core.Socket\n\tif args.Source.Valid {\n\t\tconcrete, err := args.Source.Value.Load(ctx, srv)\n\t\tif err != nil {\n\t\t\treturn inst, fmt.Errorf(\"failed to load source socket: %w\", err)\n\t\t}\n\t\tconcreteSelf, _ = dagql.UnwrapAs[*core.Socket](concrete)\n\t\tif concreteSelf == nil {\n\t\t\treturn inst, errors.New(\"source socket is nil\")\n\t\t}\n\t\tconcreteSelf, err = core.ResolveSessionSocket(ctx, concreteSelf)\n\t\tif err != nil {\n\t\t\treturn inst, fmt.Errorf(\"failed to resolve source socket: %w\", err)\n\t\t}\n\t\tif concreteSelf == nil {\n\t\t\treturn inst, errors.New(\"resolved source socket is nil\")\n\t\t}\n\t} else {\n\t\tif clientMetadata.SSHAuthSocketPath == \"\" {\n\t\t\treturn inst, errors.New(\"SSH_AUTH_SOCK is not set\")\n\t\t}\n\t\tconcreteVal := &core.Socket{\n\t\t\tKind:           core.SocketKindUnixOpaque,\n\t\t\tURLVal:         (&url.URL{Scheme: \"unix\", Path: clientMetadata.SSHAuthSocketPath}).String(),\n\t\t\tSourceClientID: clientMetadata.ClientID,\n\t\t}\n\t\tconcreteSelf = concreteVal","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/schema/host.go#L461-L497","documentation":"After loading the Source socket argument, sshAuthSocket unwraps it to *core.Socket with dagql.UnwrapAs. This error means the loaded value decoded successfully but is not a *core.Socket (or unwrapped to nil), so there is no concrete socket to work with.","triggerScenarios":"Passing a Source object that is a Socket instance but whose underlying value fails to unwrap as *core.Socket — e.g. an ID that resolves to a different concrete type or a nil payload.","commonSituations":"Mixing object kinds (passing a secret, service, or directory ID where a socket is expected); engine/SDK version skew changing the socket concrete type.","solutions":["Ensure the Source argument is genuinely a Host socket reference (e.g. from host.unixSocket or a prior sshAuthSocket call), not another type","Regenerate the client/upgrade SDK so socket IDs match the engine's concrete type","Check that the ID was not manually constructed"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if !isSocketRef(src) { return errors.New(\"source must be a Socket\") }","typeGuard":"func isSocketRef(v dagql.Typed) bool {\n    _, ok := dagql.UnwrapAs[*core.Socket](v)\n    return ok\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"source socket is nil\") {\n    // passed a non-socket object; pass a genuine Host socket instead\n}","preventionTips":["Only pass objects obtained from host.unixSocket or sshAuthSocket as Source","Don't substitute other typed objects (secret/service/directory) for sockets","Regenerate clients after engine upgrades"],"tags":["type-mismatch","socket","ssh"],"backgroundTag":"unexpected-null-value","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"}