dagger/dagger · error

failed to create stub typedef for no-sdk module %q: %w

Error message

failed to create stub typedef for no-sdk module %q: %w

What it means

For modules without an SDK (no runtime), Dagger creates a stub type definition by selecting the "withObject" field on the dagql server (SelectTypeDefWithServer) using the module's original name. If that selection fails, this error wraps it, noting it happened while creating a stub typedef for a no-SDK module.

Source

Thrown at core/schema/modulesource.go:3999

			if err := dag.Select(ctx, srcInst, &mod, dagql.Selector{Field: "asModule"}); err != nil {
				return inst, fmt.Errorf("failed to transform module source into module: %w", err)
			}

			codegenDeps = codegenDeps.With(core.NewUserMod(mod), core.InstallOpts{})
		}
	}

	return codegenDeps.SchemaIntrospectionJSONFileForClient(ctx)
}

// createStubModule creates an empty module definition (no SDK, no blueprints)
func createStubModule(ctx context.Context, mod *core.Module, dag *dagql.Server) (*core.Module, error) {
	typeDef, err := core.SelectTypeDefWithServer(ctx, dag, dagql.Selector{
		Field: "withObject",
		Args:  []dagql.NamedInput{{Name: "name", Value: dagql.String(mod.OriginalName)}},
	})
	if err != nil {
		return nil, fmt.Errorf("failed to create stub typedef for no-sdk module %q: %w", mod.NameField, err)
	}

	mod, err = mod.WithObject(ctx, typeDef)
	if err != nil {
		return nil, fmt.Errorf("failed to get module definition for no-sdk module %q: %w", mod.NameField, err)
	}

	return mod, nil
}
func (s *moduleSourceSchema) moduleSourceImplementationScoped(
	ctx context.Context,
	src dagql.ObjectResult[*core.ModuleSource],
	args struct{},
) (inst dagql.ObjectResult[*core.ModuleSource], err error) {
	sourceDigest, err := src.Self().SourceImplementationDigest(ctx)
	if err != nil {
		return inst, fmt.Errorf("failed to get module source implementation digest: %w", err)
	}

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Check the module's (original) name for invalid characters and rename the module if needed
  2. Read the wrapped %w cause for the specific withObject error
  3. Retry after fixing the module source metadata (name) in dagger.json or the source config

Example fix

// before: invalid name
// dagger.json: {"name": "My Module!"}
// after
// dagger.json: {"name": "my-module"}
Defensive patterns

Strategy: validation

Validate before calling

// validate the module name before loading a no-SDK module
name := mod.OriginalName
if name == "" || !regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_-]*$`).MatchString(name) {
    return fmt.Errorf("invalid module name: %q", name)
}

Try / catch

typeDef, err := core.SelectTypeDefWithServer(ctx, dag, dagql.Selector{Field: "withObject", Args: []dagql.NamedInput{{Name: "name", Value: dagql.String(mod.OriginalName)}}})
if err != nil {
    return nil, fmt.Errorf("failed to create stub typedef for no-sdk module %q: %w", mod.NameField, err)
}

Prevention

When it happens

Trigger: createStubModule invoked for an SDK-less module; the withObject dagql selection fails — e.g. an invalid module name argument or an error in the schema mutation path.

Common situations: Module name characters/length rejected by the schema validation; internal dagql errors during object registration; referencing a module source whose name collides or is malformed.

Related errors


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