dagger/dagger · error

namespace enum typedef: %w

Error message

namespace enum typedef: %w

What it means

Final step of enum namespacing: Dagger replaces the enum typedef in the enclosing TypeDef by selecting __withEnumTypeDef with the updated enum's ID. A failing Select is wrapped as 'namespace enum typedef', meaning the dependency enum could not be re-embedded into the typedef after namespacing.

Source

Thrown at core/module.go:1919

					Args:  []dagql.NamedInput{{Name: "member", Value: memberID}},
				}); err != nil {
					return typeDef, fmt.Errorf("namespace enum member: %w", err)
				}
			}
		}
		if sameAttachedResult(updatedEnum, enum) {
			return typeDef, nil
		}
		updatedEnumID, err := ResultIDInput(updatedEnum)
		if err != nil {
			return typeDef, fmt.Errorf("namespace enum typedef id: %w", err)
		}
		updated := typeDef
		if err := dag.Select(ctx, updated, &updated, dagql.Selector{
			Field: "__withEnumTypeDef",
			Args:  []dagql.NamedInput{{Name: "enumTypeDef", Value: updatedEnumID}},
		}); err != nil {
			return typeDef, fmt.Errorf("namespace enum typedef: %w", err)
		}
		return updated, nil
	default:
		return typeDef, nil
	}
}

func (mod *Module) namespaceSourceMap(
	ctx context.Context,
	modPath string,
	sourceMap dagql.Nullable[dagql.ObjectResult[*SourceMap]],
) (dagql.Nullable[dagql.ObjectResult[*SourceMap]], error) {
	if !sourceMap.Valid || sourceMap.Value.Self() == nil {
		// Even if the SDK didn't provide a source map, record the module
		// name so downstream consumers (CLI, shell, codegen dependency
		// filtering) can identify which module a type/function belongs to.
		// Route through dag.Select rather than NewObjectResultForCurrentCall
		// so the result is attached and callers can read its ID when calling

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Inspect the wrapped inner error for the underlying dagql failure.
  2. Update the Dagger engine and CLI and regenerate codegen (dagger develop).
  3. Verify the dependency module is loadable and its published version matches what is referenced.
  4. Retry after transient errors; escalate with a repro if persistent.
Defensive patterns

Strategy: try-catch

Try / catch

_, err := moduleSource.AsModule().GeneratedCode().Directory('.').Entries(ctx)
if err != nil {
    if strings.Contains(err.Error(), 'namespace enum typedef') { /* regenerate and retry */ }
    return err
}

Prevention

When it happens

Trigger: updatedEnumID was produced successfully, but dag.Select(ctx, updated, &updated, Field: __withEnumTypeDef) fails (dagql resolver error on the internal field, engine failure, context cancellation).

Common situations: Any cross-module enum usage during codegen or function serving where the internal __withEnumTypeDef mutation fails; engine bugs or version skew; timeouts while loading deep dependency graphs.

Related errors


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