dagger/dagger · error

builtin scalar Boolean did not decode to Typed: %T

Error message

builtin scalar Boolean did not decode to Typed: %T

What it means

Same invariant as the Float case: when decoding a persisted envelope's Boolean scalar without a dagql server, decodeBuiltinPersistedScalar requires Boolean(false).DecodeInput(raw) to return a Typed. If it does not, decoding aborts with this error because the value cannot be used as a dagql Typed value.

Source

Thrown at dagql/cache_persistence_self.go:369

		return typed, nil
	case "Float":
		input, err := Float(0).DecodeInput(raw)
		if err != nil {
			return nil, err
		}
		typed, ok := input.(Typed)
		if !ok {
			return nil, fmt.Errorf("builtin scalar Float did not decode to Typed: %T", input)
		}
		return typed, nil
	case "Boolean":
		input, err := Boolean(false).DecodeInput(raw)
		if err != nil {
			return nil, err
		}
		typed, ok := input.(Typed)
		if !ok {
			return nil, fmt.Errorf("builtin scalar Boolean did not decode to Typed: %T", input)
		}
		return typed, nil
	default:
		return nil, fmt.Errorf("unknown scalar type %q and no dagql server in context", typeName)
	}
}

// PersistedSnapshotRefLink is a generic non-opaque link from a persisted result
// self payload to one durable snapshot ref key.
type PersistedSnapshotRefLink struct {
	RefKey string
	Role   string
}

// PersistedSnapshotRefLinkProvider is the shared interface used by persistable
// self payloads to expose snapshot ref links for `result_snapshot_links`.
type PersistedSnapshotRefLinkProvider interface {
	PersistedSnapshotRefLinks() []PersistedSnapshotRefLink

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Use a matching library version for encode and decode of persisted envelopes
  2. Restore the built-in Boolean implementation whose DecodeInput returns a Typed
  3. Re-persist the result with the current version rather than decoding legacy files
Defensive patterns

Strategy: type-guard

Validate before calling

// sanity-check raw Boolean payload before decode
if b, ok := raw.(bool); !ok {
    return fmt.Errorf("Boolean scalar payload is %T, want bool", raw)
}

Type guard

func isTyped(v any) bool {
    _, ok := v.(dagql.Typed)
    return ok
}

Try / catch

typed, err := decodeBuiltinPersistedScalar("Boolean", raw)
if err != nil {
    if strings.Contains(err.Error(), "did not decode to Typed") {
        return nil, fmt.Errorf("incompatible Boolean encoding: %w", err)
    }
    return nil, err
}

Prevention

When it happens

Trigger: decodePersistedResultEnvelope processes a scalar of type "Boolean"; the assertion `input.(Typed)` on the value returned by Boolean(false).DecodeInput(raw) fails.

Common situations: Decoding persisted results across library versions where Boolean was changed; custom Boolean implementations missing the Typed interface; tampered persisted envelopes.

Related errors


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/e08723cf40afc876. Report an issue: GitHub.