{"record":{"id":"be7595884606ab5e","repo":"dagger/dagger","slug":"sdk-command-name-q-is-ambiguous-modules-s-as-sd","errorCode":null,"errorMessage":"SDK command name %q is ambiguous: modules.%s.as-sdk and modules.%s.as-sdk both use it","messagePattern":"SDK command name %q is ambiguous: modules\\.(.+?)\\.as-sdk and modules\\.(.+?)\\.as-sdk both use it","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/dagger/sdk_init_dynamic.go","lineNumber":144,"sourceCode":"\tif entry.AsSDK != nil && entry.AsSDK.Name != \"\" {\n\t\treturn entry.AsSDK.Name\n\t}\n\treturn moduleName\n}\n\nfunc configuredSDKs(cfg *workspace.Config) ([]configuredSDK, error) {\n\tif cfg == nil || cfg.Modules == nil {\n\t\treturn nil, nil\n\t}\n\tsdks := make([]configuredSDK, 0, len(cfg.Modules))\n\tseen := map[string]string{}\n\tfor moduleName, entry := range cfg.Modules {\n\t\tif entry.AsSDK == nil {\n\t\t\tcontinue\n\t\t}\n\t\tcommandName := sdkCommandName(moduleName, entry)\n\t\tif existing, ok := seen[commandName]; ok {\n\t\t\treturn nil, fmt.Errorf(\"SDK command name %q is ambiguous: modules.%s.as-sdk and modules.%s.as-sdk both use it\", commandName, existing, moduleName)\n\t\t}\n\t\tseen[commandName] = moduleName\n\t\tsdks = append(sdks, configuredSDK{\n\t\t\tmoduleName:  moduleName,\n\t\t\tcommandName: commandName,\n\t\t\tentry:       entry,\n\t\t})\n\t}\n\tsort.Slice(sdks, func(i, j int) bool {\n\t\tif sdks[i].commandName != sdks[j].commandName {\n\t\t\treturn sdks[i].commandName < sdks[j].commandName\n\t\t}\n\t\treturn sdks[i].moduleName < sdks[j].moduleName\n\t})\n\treturn sdks, nil\n}\n\nfunc resolveConfiguredSDK(cfg *workspace.Config, sdkName string) (configuredSDK, error) {","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/internal/cmd/dagger/sdk_init_dynamic.go#L126-L162","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (dagger.json)\n\"modules\": { \"a\": {\"as-sdk\": {\"name\": \"py\"}}, \"b\": {\"as-sdk\": {\"name\": \"py\"}} }\n// after\n\"modules\": { \"a\": {\"as-sdk\": {\"name\": \"py\"}}, \"b\": {\"as-sdk\": {\"name\": \"py2\"}} }","handlingStrategy":"validation","validationCode":"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\"","typeGuard":null,"tryCatchPattern":"if err := cfg.Validate(); err != nil && strings.Contains(err.Error(), \"is ambiguous\") { return fmt.Errorf(\"fix dagger.json: %w\", err) }","preventionTips":["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"],"tags":["cli","config","sdk","naming-conflict"],"backgroundTag":"duplicate-identifier","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}