{"record":{"id":"9ec4d439345506da","repo":"github/copilot-sdk","slug":"creating-runtime-asset-directory-w","errorCode":null,"errorMessage":"creating runtime asset directory: %w","messagePattern":"creating runtime asset directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/internal/embeddedcli/embeddedcli.go","lineNumber":405,"sourceCode":"\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"reading runtime assets: %w\", err)\n\t\t}\n\t\tif header.Typeflag != tar.TypeReg {\n\t\t\tcontinue\n\t\t}\n\t\tclean := filepath.Clean(filepath.FromSlash(header.Name))\n\t\tif !filepath.IsLocal(clean) {\n\t\t\treturn fmt.Errorf(\"unsafe runtime asset path %q\", header.Name)\n\t\t}\n\t\tcontent, err := io.ReadAll(tarReader)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"reading runtime asset %q: %w\", header.Name, err)\n\t\t}\n\t\tpath := filepath.Join(installDir, clean)\n\t\tif err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {\n\t\t\treturn fmt.Errorf(\"creating runtime asset directory: %w\", err)\n\t\t}\n\t\thash := sha256.Sum256(content)\n\t\tmode := os.FileMode(header.Mode & 0777)\n\t\tif err := installVerifiedFile(path, bytes.NewReader(content), hash[:], mode, \"runtime asset\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\truntimeAssetsInstalled = true\n\treturn nil\n}\n\nfunc validateRuntimePairConfig(wrapper io.Reader, wrapperHash []byte, node io.Reader, nodeHash []byte, prefix string) {\n\tif (wrapper == nil) != (node == nil) {\n\t\tpanic(prefix + \"RuntimeExecutable and \" + prefix + \"RuntimeNode must be provided together\")\n\t}\n\tif wrapper == nil {\n\t\treturn\n\t}","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/internal/embeddedcli/embeddedcli.go#L387-L423","documentation":"After reading a runtime asset from the tar archive, installRuntimeAssets creates the parent directories for its destination path with os.MkdirAll(dir, 0755). This error wraps a failure of that MkdirAll call, i.e. the asset's target directory could not be created.","triggerScenarios":"os.MkdirAll(filepath.Dir(path), 0755) fails while extracting any entry during installAt or installRuntimeAt — typically a permission problem on installDir or a component of the path.","commonSituations":"Installing into a directory the current user cannot write (e.g. /usr/local or Program Files without elevation), installDir pointing at a read-only filesystem, or a file existing where a directory is needed.","solutions":["Check permissions on installDir and its parents; run the install with sufficient privileges (elevate or chown the target directory).","Ensure installDir is on a writable filesystem and no regular file occupies a path that must be a directory.","Choose a user-writable installDir instead of a system location."],"exampleFix":"// before\nclient.InstallAt(\"/usr/local/lib/mycli\")\n// after\nclient.InstallAt(filepath.Join(os.Getenv(\"HOME\"), \".local/lib/mycli\"))","handlingStrategy":"validation","validationCode":"func canWriteDir(dir string) error {\n    probe := filepath.Join(dir, \".write-probe\")\n    if err := os.MkdirAll(dir, 0o755); err != nil {\n        return err\n    }\n    f, err := os.Create(probe)\n    if err != nil {\n        return err\n    }\n    f.Close()\n    return os.Remove(probe)\n}","typeGuard":null,"tryCatchPattern":"if err := client.InstallAt(dir); err != nil {\n    if strings.Contains(err.Error(), \"creating runtime asset directory\") {\n        // surface a friendly 'check permissions on <dir>' message\n    }\n}","preventionTips":["Install under user-writable directories","Check writability before installing","Avoid installing to system paths without elevation"],"tags":["filesystem","mkdir","permissions"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}