dagger/dagger · error
mark local type
Error message
mark local %s type: %w
What it means
This error wraps a failure from the internal dagql `__withName` selection performed while giving a local Dang type a temporary non-core schema name (e.g. `DangSDKLocalType<Name>`) via `withDangLocalName`, invoked by `markDangLocalType`. The temporary rename prevents local type names like `Container` from colliding with core schema types before module namespacing runs. When the GraphQL-style selection that renames the type fails, the error is wrapped with the type `kind` (object, interface, or enum) and propagated, aborting module initialization.
Solutions
- Inspect the wrapped inner error (`%w` chain) to find the actual dagql failure for the `__withName` selector.
- Check that the TypeDef's AsObject/AsInterface/AsEnum value is non-nil and valid before marking.
- Verify the dagger engine/dagql server version supports the internal `__withName` field.
- Retry module initialization if the failure was due to a transient context cancellation or engine error.
Example fix
// before: opaque failure deep in init
mod, err := sdk.InitDangModule(ctx, srv, env)
// after: surface the wrapped cause
if err != nil {
log.Fatalf("init module: %v (see unwrapped: %+v)", err, errors.Unwrap(err))
} Defensive patterns
Strategy: try-catch
Try / catch
mod, err := initDangModule(ctx, srv, env)
if err != nil {
if strings.Contains(err.Error(), "mark local") {
var dagqlErr error
if errors.As(err, &dagqlErr) { /* inspect inner dagql failure */ }
return fmt.Errorf("local type rename failed during module init: %w", err)
}
return err
} Prevention
- Avoid naming local types exactly after core types unless shadowing is intended and supported.
- Keep the dagger engine and Dang SDK versions aligned.
- Log the fully unwrapped error chain during module development.
- Validate TypeDef kind and value are populated before module init.
When it happens
Trigger: Calling `markDangLocalType` on a TypeDef whose underlying Object/Interface/Enum value fails the `srv.Select(ctx, res, &renamed, {Field: "__withName", ...})` call — e.g. the dagql server rejects the `__withName` selector for that type, the context is cancelled, or the underlying object result is invalid.
Common situations: A user module defines a local type whose name shadows a core type (like `Container`); during SDK module init the temporary rename step fails because the dagql server cannot serve `__withName` for that kind, or the engine call fails mid-initialization.
Related errors
- failed to add constructor to object
- mark local typedef
- failed to create constructor for
- failed to create enum
- failed to create object
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/d05ea6ab7b9cd809.
Report an issue: GitHub.
Appendix: source
Thrown at core/sdk/dang/v2/helpers.go:476
return "DangSDKLocalType" + name
}
func withDangLocalName[T dagql.Typed](
ctx context.Context,
srv *dagql.Server,
typeDef dagql.ObjectResult[*core.TypeDef],
res dagql.ObjectResult[T],
temporaryName string,
kind string,
withField string,
argName string,
) (dagql.ObjectResult[*core.TypeDef], error) {
var renamed dagql.ObjectResult[T]
if err := srv.Select(ctx, res, &renamed, dagql.Selector{
Field: "__withName",
Args: []dagql.NamedInput{{Name: "name", Value: dagql.String(temporaryName)}},
}); err != nil {
return typeDef, fmt.Errorf("mark local %s type: %w", kind, err)
}
renamedID, err := core.ResultIDInput(renamed)
if err != nil {
return typeDef, fmt.Errorf("local %s type ID: %w", kind, err)
}
var updated dagql.ObjectResult[*core.TypeDef]
if err := srv.Select(ctx, typeDef, &updated, dagql.Selector{
Field: withField,
Args: []dagql.NamedInput{{Name: argName, Value: renamedID}},
}); err != nil {
return typeDef, fmt.Errorf("mark local %s typedef: %w", kind, err)
}
return updated, nil
}
// markDangLocalType gives a local Dang type a temporary, non-core schema name
// while preserving its OriginalName. Core's Module.WithObject namespacing later
// uses OriginalName to produce the final module-prefixed name; the temporaryView on GitHub (pinned to 82ba2681db)