dagger/dagger · error

encode persisted function call: nil function call

Error message

encode persisted function call: nil function call

What it means

EncodePersistedObject nil-guard: FunctionCall.EncodePersistedObject was invoked on a nil receiver. Persistence refuses to serialize a nil active function call instead of emitting a meaningless empty payload.

Source

Thrown at core/typedef.go:2469

var _ dagql.PersistedObject = (*FunctionCall)(nil)
var _ dagql.PersistedObjectDecoder = (*FunctionCall)(nil)

func (*FunctionCall) Type() *ast.Type {
	return &ast.Type{
		NamedType: "FunctionCall",
		NonNull:   true,
	}
}

func (*FunctionCall) TypeDescription() string {
	return "An active function call."
}

func (fnCall *FunctionCall) EncodePersistedObject(ctx context.Context, cache dagql.PersistedObjectCache) (dagql.PersistedObjectEncoding, error) {
	_ = ctx
	_ = cache
	if fnCall == nil {
		return dagql.PersistedObjectEncoding{}, fmt.Errorf("encode persisted function call: nil function call")
	}
	return encodePersistedObjectPayload(persistedFunctionCall(*fnCall))
}

func (*FunctionCall) DecodePersistedObject(ctx context.Context, dag *dagql.Server, _ uint64, _ *dagql.ResultCall, payload json.RawMessage) (dagql.Typed, error) {
	_ = ctx
	_ = dag
	var persisted persistedFunctionCall
	if err := json.Unmarshal(payload, &persisted); err != nil {
		return nil, fmt.Errorf("decode persisted function call payload: %w", err)
	}
	fnCall := FunctionCall(persisted)
	return &fnCall, nil
}

func (fnCall *FunctionCall) ReturnValue(ctx context.Context, val JSON) error {
	_ = ctx

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Skip the cache write when the function call is nil
  2. Fix upstream flow that let a nil FunctionCall reach the persistence layer
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at core/typedef.go:2469 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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