dagger/dagger · error

attach enum typedef source map: %w

Error message

attach enum typedef source map: %w

What it means

EnumTypeDef.AttachDependencyResults got an error back from the attach callback while re-attaching the enum's SourceMap result. The wrap points at dagql dependency hydration failing for the source-map object, not at the enum itself.

Source

Thrown at core/typedef.go:2056

	return decodePersistedEnumTypeDef(ctx, dag, &persisted)
}

//nolint:dupl // symmetric with InterfaceTypeDef.AttachDependencyResults; each typedef kind walks its own fields
func (enum *EnumTypeDef) AttachDependencyResults(
	ctx context.Context,
	_ dagql.AnyResult,
	attach func(dagql.AnyResult) (dagql.AnyResult, error),
) ([]dagql.AnyResult, error) {
	if enum == nil {
		return nil, nil
	}

	owned := make([]dagql.AnyResult, 0, 1+len(enum.Members))

	if enum.SourceMap.Valid && enum.SourceMap.Value.Self() != nil {
		attached, err := attach(enum.SourceMap.Value)
		if err != nil {
			return nil, fmt.Errorf("attach enum typedef source map: %w", err)
		}
		typed, ok := attached.(dagql.ObjectResult[*SourceMap])
		if !ok {
			return nil, fmt.Errorf("attach enum typedef source map: unexpected result %T", attached)
		}
		enum.SourceMap = dagql.NonNull(typed)
		owned = append(owned, typed)
	}
	for i, member := range enum.Members {
		if member.Self() == nil {
			continue
		}
		attached, err := attach(member)
		if err != nil {
			return nil, fmt.Errorf("attach enum typedef member %d: %w", i, err)
		}
		typed, ok := attached.(dagql.ObjectResult[*EnumMemberTypeDef])
		if !ok {

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Inspect the wrapped inner error for the root cause
  2. Re-sync/rebuild the module so source maps are regenerated
  3. Clear engine cache and retry the module load
  4. Update dagger CLI/SDK to matching versions
Defensive patterns

Strategy: try-catch

Validate before calling

if enum.SourceMap.Valid && enum.SourceMap.Value.Self() != nil {
    // only then attach
}

Try / catch

if err != nil && strings.Contains(err.Error(), "attach enum typedef source map") {
    // inspect wrapped cause; retry after re-syncing module / clearing cache
}

Prevention

When it happens

Trigger: The enum typedef carries a valid SourceMap whose underlying object cannot be attached to the dagql server (e.g. its dependencies are not resolvable during attach).

Common situations: Engine-side attach pipeline failure while loading a module whose enum carries source-map metadata; missing dependency results for the SourceMap object.

Related errors


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