{"record":{"id":"a4a00387740b2748","repo":"dagger/dagger","slug":"load-s-instantiate-base-w","errorCode":null,"errorMessage":"load %s: instantiate base: %w","messagePattern":"load (.+?): instantiate base: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dagql/server.go","lineNumber":1549,"sourceCode":"\t\t\treturn nil\n\t\t})\n\t}\n\tif err := eg.Wait(); err != nil {\n\t\treturn nil, fmt.Errorf(\"load %s: inputs: %w\", idInputDebugString(id), err)\n\t}\n\tvar base AnyResult\n\tif receiver := id.Receiver(); receiver != nil {\n\t\tbase = loadedInputs[receiver.Digest().String()]\n\t\tif base == nil {\n\t\t\treturn nil, fmt.Errorf(\"load %s: missing loaded receiver\", idInputDebugString(id))\n\t\t}\n\t} else {\n\t\tbase = state.srv.root\n\t}\n\n\tbaseObj, err := state.srv.toSelectable(state.ctx, base)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"load %s: instantiate base: %w\", idInputDebugString(id), err)\n\t}\n\tframe, err := state.loadedResultCallFromRecipeID(id, loadedInputs, lazyRefs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"load %s: build result call: %w\", idInputDebugString(id), err)\n\t}\n\tcallCtx = ContextWithCall(callCtx, frame)\n\tsel, err := selectorFromLoadedCall(callCtx, frame, baseObj, id, lazyRefs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"load %s: %w\", idInputDebugString(id), err)\n\t}\n\treq := &CallRequest{ResultCall: frame}\n\tif hit, ok, err := state.cache.lookupCallRequest(callCtx, state.sessionID, state.srv, req); err != nil {\n\t\treturn nil, fmt.Errorf(\"load %s: structural cache lookup: %w\", idInputDebugString(id), err)\n\t} else if ok {\n\t\treturn hit, nil\n\t}\n\treturn baseObj.Select(callCtx, state.srv, sel)\n}","sourceCodeStart":1531,"sourceCodeEnd":1567,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/dagql/server.go#L1531-L1567","documentation":"Once inputs are loaded, the base (receiver or root) result must be converted to a selectable object via srv.toSelectable. If the base result cannot be instantiated as a selectable (wrong result kind, nil payload, unsupported type), the load fails with 'instantiate base'.","triggerScenarios":"toSelectable fails on the base AnyResult — e.g. the receiver's cached result is not an object/selectable kind, its payload was evicted or is nil, or the root object wiring is wrong.","commonSituations":"Loading an ID whose receiver resolves to a scalar/enum instead of an object; cache eviction of the payload between the lookup and instantiation; embedding dagql with a misconfigured root object.","solutions":["Verify the ID chain targets an object-returning selection (not a scalar) before further selection","Re-run the query to rebuild results if the payload was evicted","Check engine logs for the underlying toSelectable failure wrapped in %w","If embedding dagql, ensure Server root is a properly registered selectable object"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure the selection chain ends in an object type before loading deeper\nif id != nil && id.Type() != nil && id.Type().Kind() == dagql.ScalarKind {\n\treturn errors.New(\"cannot select fields on a scalar result\")\n}","typeGuard":"func isSelectableBase(res dagql.AnyResult) bool {\n\treturn res != nil && res.Type() != nil &&\n\t\t(res.Type().Kind() == dagql.ObjectKind || res.Type().Kind() == dagql.InterfaceKind)\n}","tryCatchPattern":"res, err := srv.LoadType(ctx, id)\nif err != nil {\n\tif strings.Contains(err.Error(), \"instantiate base\") {\n\t\t// base result is not a selectable object; rebuild the chain from the root\n\t}\n\treturn err\n}","preventionTips":["Only chain further selections off object-typed results","Re-run queries if payloads may have been evicted between steps","When embedding dagql, register the root object correctly","Check engine logs for the underlying toSelectable cause"],"tags":["dagql","selectable","instantiation"],"backgroundTag":"instantiate-base-failed","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"}