dagger/dagger · error

failed to decode source map: %w

Error message

failed to decode source map: %w

What it means

Wrapped error in functionWithSourceMap: args.SourceMap.Load(ctx, dag) failed — the SourceMapID given to withSourceMap could not be decoded into a SourceMap object, so the function's doc source location cannot be attached. Typically a malformed or foreign ID.

Source

Thrown at core/schema/module.go:1742

	}
	returnType, err := args.ReturnType.Load(ctx, dag)
	if err != nil {
		return nil, fmt.Errorf("failed to decode return type: %w", err)
	}
	return fn.WithReturnType(returnType), nil
}

func (s *moduleSchema) functionWithSourceMap(ctx context.Context, fn *core.Function, args struct {
	SourceMap core.SourceMapID
}) (*core.Function, error) {
	dag, err := core.CurrentDagqlServer(ctx)
	if err != nil {
		return nil, fmt.Errorf("failed to get dag server: %w", err)
	}

	sourceMap, err := args.SourceMap.Load(ctx, dag)
	if err != nil {
		return nil, fmt.Errorf("failed to decode source map: %w", err)
	}
	return fn.WithSourceMap(sourceMap), nil
}

func (s *moduleSchema) functionWithSourceMapResult(ctx context.Context, fn *core.Function, args struct {
	SourceMap dagql.Optional[core.SourceMapID]
}) (*core.Function, error) {
	sourceMap, err := s.loadSourceMapResult(ctx, args.SourceMap)
	if err != nil {
		return nil, err
	}
	return fn.WithSourceMap(sourceMap), nil
}

func (s *moduleSchema) functionArgWithTypeDef(ctx context.Context, arg *core.FunctionArg, args struct {
	TypeDef core.TypeDefID
}) (*core.FunctionArg, error) {
	dag, err := core.CurrentDagqlServer(ctx)

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Re-create the SourceMap via withSourceMap on the current session and use the fresh ID
  2. Verify the ID string is a valid core.SourceMapID
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at core/schema/module.go:1742 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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