{"record":{"id":"01743d17ca4bb2cf","repo":"pulumi/pulumi","slug":"unable-to-create-q-for-generated-sdks-w","errorCode":null,"errorMessage":"unable to create %q for generated SDKs: %w","messagePattern":"unable to create %q for generated SDKs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/packageworkspace/packageworkspace.go","lineNumber":283,"sourceCode":"\n\tpkgName := boundSchema.Name\n\tif boundSchema.Namespace != \"\" {\n\t\tpkgName = boundSchema.Namespace + \"-\" + pkgName\n\t}\n\n\tsdkDir := filepath.Join(projectDir, \"sdks\")\n\tout := filepath.Join(sdkDir, pkgName)\n\n\t// Make sure the out directory doesn't exist anymore.\n\t//\n\t// [os.RemoveAll] handles the case  where out doesn't exist.\n\tif err := os.RemoveAll(out); err != nil {\n\t\treturn workspace.LinkablePackageDescriptor{}, err\n\t}\n\n\t// Now move the temp directory to it's final home.\n\tif err := os.Mkdir(sdkDir, 0o755); err != nil && !errors.Is(err, os.ErrExist) {\n\t\treturn workspace.LinkablePackageDescriptor{}, fmt.Errorf(\"unable to create %q for generated SDKs: %w\", sdkDir, err)\n\t}\n\n\t// We copy instead of renaming to be robust to multiple FS partitions or drives.\n\t//\n\t// For example https://github.com/pulumi/pulumi/issues/21547.\n\tif err := fsutil.CopyFile(out, tmpDir, nil); err != nil {\n\t\t// If this failed, we still need to clean up tmpDir.\n\t\treturn workspace.LinkablePackageDescriptor{}, errors.Join(err, os.RemoveAll(tmpDir))\n\t}\n\n\t// We have now generated a SDK, the only thing left to do is link it into the existing project.\n\n\tsdkPath, err := filepath.Rel(projectDir, out)\n\tif err != nil {\n\t\treturn workspace.LinkablePackageDescriptor{}, err\n\t}\n\tdesc, err := boundSchema.Descriptor(ctx)\n\tif err != nil {","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/packageworkspace/packageworkspace.go#L265-L301","documentation":"After generating into a temp dir, the workspace creates the final SDK directory (sdkDir) with os.Mkdir. If mkdir fails for a reason other than already-exists, this error wraps the OS error.","triggerScenarios":"os.Mkdir(sdkDir, 0o755) fails with e.g. EACCES (no write permission on parent), ENOTDIR (sdkDir path contains a file component), or a path collision where a non-directory exists and errors.Is check doesn't cover it.","commonSituations":"Read-only project directories (CI checkout with restricted perms); a file named `sdk` already exists in the project; sandboxed/readonly containers.","solutions":["Check write permissions on the project directory and its parent","Remove or rename any file conflicting with the SDK output path (e.g. ./sdk)","Run the command in a writable directory / fix ownership (chown/chmod)","Check for read-only mounts in containers or CI"],"exampleFix":"// before\n-rw-r--r-- sdk   # a file where the sdk dir should go\n// after\nrm ./sdk  # or rename it, then re-run pulumi package add","handlingStrategy":"validation","validationCode":"// Ensure the SDK output path is creatable before running\nif _, err := os.Stat(\"./sdk\"); err == nil {\n    // exists: ensure it's a directory and writable\n}\nif err := os.MkdirAll(\"./sdk\", 0o755); err != nil { /* fix perms/conflicts */ }","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Never commit a file named `sdk` where generated SDKs go","Run with a writable project directory in CI","Check container mount permissions before codegen"],"tags":["filesystem","permissions"],"backgroundTag":"permission-denied","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}