{"record":{"id":"d30388d918128a30","repo":"dagger/dagger","slug":"q-is-not-installed-as-an-sdk-in-this-workspace-r-d30388","errorCode":null,"errorMessage":"%q is not installed as an SDK in this workspace; run `dagger sdk install %s` first","messagePattern":"%q is not installed as an SDK in this workspace; run `dagger sdk install (.+?)` first","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/dagger/sdk_init_dynamic.go","lineNumber":164,"sourceCode":"\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) {\n\tif cfg == nil || cfg.Modules == nil {\n\t\treturn configuredSDK{}, fmt.Errorf(\"%q is not installed as an SDK in this workspace; run `dagger sdk install %s` first\", sdkName, sdkName)\n\t}\n\tif entry, ok := cfg.Modules[sdkName]; ok && entry.AsSDK != nil {\n\t\treturn configuredSDK{\n\t\t\tmoduleName:  sdkName,\n\t\t\tcommandName: sdkCommandName(sdkName, entry),\n\t\t\tentry:       entry,\n\t\t}, nil\n\t}\n\n\tvar matches []configuredSDK\n\tfor moduleName, entry := range cfg.Modules {\n\t\tif entry.AsSDK == nil || entry.AsSDK.Name != sdkName {\n\t\t\tcontinue\n\t\t}\n\t\tmatches = append(matches, configuredSDK{\n\t\t\tmoduleName:  moduleName,\n\t\t\tcommandName: sdkCommandName(moduleName, entry),\n\t\t\tentry:       entry,","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/internal/cmd/dagger/sdk_init_dynamic.go#L146-L182","documentation":"Thrown by resolveConfiguredSDK when the requested SDK name cannot be resolved because the workspace config is nil or has no modules map — i.e. no SDKs are installed at all. It suggests `dagger sdk install <name>`.","triggerScenarios":"`dagger sdk uninstall <name>` or `dagger sdk init <name>` (init options flow) in a workspace whose dagger.json exists but has no `modules` entries, or when no workspace config was loaded (cfg == nil).","commonSituations":"Fresh workspace created with `dagger init` but no SDK ever installed; calling uninstall with the wrong expectation that an SDK is present; config file present but modules section empty.","solutions":["Run `dagger sdk install <sdk>` first to add the SDK to the workspace config","Verify dagger.json in the workspace root contains a modules entry with as-sdk for this SDK","Check you are in the correct workspace (the config found may be an unrelated parent one)"],"exampleFix":"// before (dagger.json)\n{ \"modules\": {} }\n// after\n$ dagger sdk install python\n{ \"modules\": { \"python\": { \"as-sdk\": {} } } }","handlingStrategy":"validation","validationCode":"test -f dagger.json && jq -e '.modules' dagger.json >/dev/null || { echo \"no modules installed; run dagger sdk install <sdk>\"; }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"is not installed as an SDK\") { fmt.Fprintln(os.Stderr, \"Install the SDK first: dagger sdk install <sdk>\"); os.Exit(1) }","preventionTips":["Install the SDK before attempting init/uninstall operations","Keep dagger.json's modules section populated and committed","Confirm you are in the intended workspace before sdk commands"],"tags":["cli","sdk","config","not-installed"],"backgroundTag":"sdk-not-installed","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"}