dagger/dagger · error

load ID: %w

Error message

load ID: %w

What it means

Once a valid attached ID is available, ConvertToSDKInput calls dag.Load(ctx, id) on the current dagql server to materialize the object. This error wraps any failure from that load — typically a cache miss (the engine result backing the ID no longer exists), a malformed ID, or no current server context.

Source

Thrown at core/object.go:129

		}
		return moduleObjectFieldsToSDKInput(ctx, t, parentCall, x.Self().Fields)
	case *ModuleObject:
		return moduleObjectFieldsToSDKInput(ctx, t, dagql.CurrentCall(ctx), x.Fields)
	case dagql.IDable:
		dag, err := CurrentDagqlServer(ctx)
		if err != nil {
			return nil, fmt.Errorf("current dagql server: %w", err)
		}
		id, err := x.ID()
		if err != nil {
			return nil, fmt.Errorf("load object ID: %w", err)
		}
		if id == nil || id.EngineResultID() == 0 {
			return nil, fmt.Errorf("load object ID: expected attached result ID")
		}
		val, err := dag.Load(ctx, id)
		if err != nil {
			return nil, fmt.Errorf("load ID: %w", err)
		}
		switch x := val.(type) {
		case dagql.ObjectResult[*ModuleObject]:
			parentCall, err := x.ResultCall()
			if err != nil {
				return nil, fmt.Errorf("loaded module object SDK input call frame: %w", err)
			}
			return moduleObjectFieldsToSDKInput(ctx, t, parentCall, x.Self().Fields)
		default:
			return nil, fmt.Errorf("unexpected value type %T", x)
		}
	default:
		return nil, fmt.Errorf("%T.ConvertToSDKInput cannot handle %T", t, x)
	}
}

func moduleObjectFieldsToSDKInput(ctx context.Context, t *ModuleObjectType, parentCall *dagql.ResultCall, fields map[string]any) (map[string]any, error) {
	if len(fields) == 0 {

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Convert the object to SDK input within the same engine session that produced it
  2. Verify the ID is well-formed and belongs to the current engine's cache
  3. Avoid storing IDs long-term; store the serialized SDK input (the JSON fields) instead
  4. Check the wrapped dag.Load error to distinguish cache-miss vs malformed-ID

Example fix

// before
// id saved to disk, engine restarted, dag.Load fails
ConvertToSDKInput(ctx, idableFromOldID)
// after
// re-execute the query to get a fresh, loadable ID
val, err := dag.Load(ctx, freshID)
ConvertToSDKInput(ctx, val)
Defensive patterns

Strategy: try-catch

Validate before calling

// verify the ID still loads before conversion
if _, err := dag.Load(ctx, id); err != nil {
    return fmt.Errorf("ID no longer loadable in this session: %w", err)
}

Type guard

func loadableIn(dagql *dagql.Server, ctx context.Context, id dagql.ID) bool {
    _, err := dagql.Load(ctx, id)
    return err == nil
}

Try / catch

converted, err := objType.ConvertToSDKInput(ctx, val)
if err != nil && strings.Contains(err.Error(), "load ID:") {
    return fmt.Errorf("backing engine result is gone; re-run the query that produced this object: %w", err)
}

Prevention

When it happens

Trigger: Thrown at core/object.go:129 when the library encounters an invalid state.

Common situations: Engine restart or cache eviction between obtaining the object and converting it; passing an ID produced by a different engine/session; IDs crossing module boundaries where the result wasn't persisted.

Related errors


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