dagger/dagger · error
SDK command name %q is ambiguous: modules.%s.as-sdk and modu
Error message
SDK command name %q is ambiguous: modules.%s.as-sdk and modules.%s.as-sdk both use it
What it means
Thrown by configuredSDKs when registering dynamic `dagger sdk init <name>` commands from a workspace config: two different modules declare `as-sdk` entries that resolve to the same CLI command name. Because the command name must be unique, registration is rejected with both conflicting module names listed.
Source
Thrown at internal/cmd/dagger/sdk_init_dynamic.go:144
if entry.AsSDK != nil && entry.AsSDK.Name != "" {
return entry.AsSDK.Name
}
return moduleName
}
func configuredSDKs(cfg *workspace.Config) ([]configuredSDK, error) {
if cfg == nil || cfg.Modules == nil {
return nil, nil
}
sdks := make([]configuredSDK, 0, len(cfg.Modules))
seen := map[string]string{}
for moduleName, entry := range cfg.Modules {
if entry.AsSDK == nil {
continue
}
commandName := sdkCommandName(moduleName, entry)
if existing, ok := seen[commandName]; ok {
return nil, fmt.Errorf("SDK command name %q is ambiguous: modules.%s.as-sdk and modules.%s.as-sdk both use it", commandName, existing, moduleName)
}
seen[commandName] = moduleName
sdks = append(sdks, configuredSDK{
moduleName: moduleName,
commandName: commandName,
entry: entry,
})
}
sort.Slice(sdks, func(i, j int) bool {
if sdks[i].commandName != sdks[j].commandName {
return sdks[i].commandName < sdks[j].commandName
}
return sdks[i].moduleName < sdks[j].moduleName
})
return sdks, nil
}
func resolveConfiguredSDK(cfg *workspace.Config, sdkName string) (configuredSDK, error) {View on GitHub (pinned to 82ba2681db)
Solutions
- Rename one entry's `as-sdk.name` in dagger.json so each SDK command name is unique
- Remove the duplicate as-sdk entry if one module is no longer meant to be an SDK
- Run `dagger sdk list` after fixing to confirm commands register cleanly
Example fix
// before (dagger.json)
"modules": { "a": {"as-sdk": {"name": "py"}}, "b": {"as-sdk": {"name": "py"}} }
// after
"modules": { "a": {"as-sdk": {"name": "py"}}, "b": {"as-sdk": {"name": "py2"}} } Defensive patterns
Strategy: validation
Validate before calling
names=$(jq -r '.modules | to_entries[] | select(.value."as-sdk") | .value."as-sdk".name // .key' dagger.json); d=$(echo "$names" | sort | uniq -d); [ -z "$d" ] || echo "duplicate SDK command names: $d"
Try / catch
if err := cfg.Validate(); err != nil && strings.Contains(err.Error(), "is ambiguous") { return fmt.Errorf("fix dagger.json: %w", err) } Prevention
- Give every as-sdk entry a unique explicit name in dagger.json
- Run `dagger sdk list` after editing modules to catch duplicates early
- When copying module entries, always update the as-sdk name
When it happens
Trigger: Workspace config has two modules, e.g. modules.A.as-sdk and modules.B.as-sdk, whose effective command names (explicit as-sdk.name or module name) are identical.
Common situations: Copying a module entry in dagger.json and forgetting to change its as-sdk name; two modules deliberately named the same; an explicit `as-sdk: name` duplicating another module's default command name.
Related errors
- %q is not installed as an SDK in this workspace; run `dagger
- SDK name %q is ambiguous: matches modules.%s.as-sdk; choose
- sdk %q initModule must not modify engine-owned file(s): %s
- unknown sdk config keys found %v
- cannot unset %q; SDK state is managed by dagger install
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/be7595884606ab5e.
Report an issue: GitHub.