{"record":{"id":"0c85b628da3f90a2","repo":"dagger/dagger","slug":"load-s-expected-s-got-s","errorCode":null,"errorMessage":"load %s: expected %s, got %s","messagePattern":"load (.+?): expected (.+?), got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dagql/server.go","lineNumber":1434,"sourceCode":"\t\tres, err := cache.loadResultByResultID(ctx, sessionID, s, id.EngineResultID())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif id.Type() != nil && id.Type().ToAST().NonNull {\n\t\t\tif derefCapable, ok := res.(interface{ withDerefViewAny() AnyResult }); ok {\n\t\t\t\tif shared := res.cacheSharedResult(); shared != nil {\n\t\t\t\t\tpayload := shared.loadPayloadState()\n\t\t\t\t\tif inner, valid := derefTyped(payload.self); valid && inner != nil && inner.Type() != nil && inner.Type().Name() == id.Type().NamedType() {\n\t\t\t\t\t\tres = derefCapable.withDerefViewAny()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif id.Type() != nil && !id.Type().ToAST().NonNull && res.Type() != nil && res.Type().NonNull && res.Type().Name() == id.Type().NamedType() {\n\t\t\tres = res.NullableWrapped()\n\t\t}\n\t\tif id.Type() != nil && res.Type() != nil && res.Type().Name() != id.Type().NamedType() {\n\t\t\treturn nil, fmt.Errorf(\"load %s: expected %s, got %s\", idInputDebugString(id), id.Type().ToAST(), res.Type())\n\t\t}\n\t\treturn res, nil\n\t}\n\n\tstate := &recipeLoadState{\n\t\tctx:       ctx,\n\t\tsrv:       s,\n\t\tcache:     cache,\n\t\tsessionID: sessionID,\n\t\tloads:     make(map[string]*recipeLoadFuture),\n\t}\n\treturn state.load(id)\n}\n\ntype recipeLoadFuture struct {\n\tdone chan struct{}\n\tres  AnyResult\n\terr  error","sourceCodeStart":1416,"sourceCodeEnd":1452,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/dagql/server.go#L1416-L1452","documentation":"When loading a result by handle ID, LoadType verifies the cached result's type matches the type encoded in the ID. If the names differ, the result cannot be safely reused and this mismatch error is returned, showing expected vs got types.","triggerScenarios":"Presenting a cached result ID whose encoded type (id.Type().NamedType()) differs from the type stored in the cache under that engine result ID — e.g. an ID from an older schema version, a serialized ID string edited or carried across a Dagger version upgrade, or reusing a handle across incompatible types.","commonSituations":"Upgrading Dagger between releases where core types were renamed/changed while old IDs were persisted; hand-editing or truncating ID strings; sharing IDs between different engine versions.","solutions":["Re-derive the ID and re-run the query on the current engine instead of loading a stale persisted ID","Ensure the Dagger engine/CLI versions match wherever IDs are produced and consumed","Don't reuse IDs across schema versions; serialize IDs only with the same version that created them","Verify the ID string is complete and unmodified"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// decode the ID and sanity-check it before use\nid, err := dagql.DecodeIDString(idStr)\nif err != nil || id.Type() == nil {\n\treturn fmt.Errorf(\"invalid or foreign ID: %w\", err)\n}","typeGuard":"func sameNamedType(id *dagql.CallID, res dagql.AnyResult) bool {\n\treturn id != nil && id.Type() != nil && res != nil &&\n\t\tres.Type() != nil && res.Type().Name() == id.Type().NamedType()\n}","tryCatchPattern":"res, err := srv.LoadType(ctx, id)\nif err != nil {\n\tif strings.Contains(err.Error(), \"expected \") && strings.Contains(err.Error(), \"got \") {\n\t\t// type mismatch: ID is stale or from another schema; rebuild it\n\t}\n\treturn err\n}","preventionTips":["Never reuse IDs across Dagger versions or schema changes","Don't hand-edit serialized ID strings","Pin matching engine/CLI versions wherever IDs are shared","Re-derive IDs from live queries instead of persisting them long-term"],"tags":["dagql","type-mismatch","cache","schema-version"],"backgroundTag":"type-mismatch","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"}