github/copilot-sdk · error
creating runtime asset directory
Error message
creating runtime asset directory: %w
What it means
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.
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.
Example fix
// before
client.InstallAt("/usr/local/lib/mycli")
// after
client.InstallAt(filepath.Join(os.Getenv("HOME"), ".local/lib/mycli")) Defensive patterns
Strategy: validation
Validate before calling
func canWriteDir(dir string) error {
probe := filepath.Join(dir, ".write-probe")
if err := os.MkdirAll(dir, 0o755); err != nil {
return err
}
f, err := os.Create(probe)
if err != nil {
return err
}
f.Close()
return os.Remove(probe)
} Try / catch
if err := client.InstallAt(dir); err != nil {
if strings.Contains(err.Error(), "creating runtime asset directory") {
// surface a friendly 'check permissions on <dir>' message
}
} Prevention
- Install under user-writable directories
- Check writability before installing
- Avoid installing to system paths without elevation
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.
Related errors
- Published runtime wrapper is not a non-empty executable…
- Failed to make Copilot CLI executable:
- failed to create output directory
- failed to chmod binary
- creating install directory
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/9ec4d439345506da.
Report an issue: GitHub.
Appendix: source
Thrown at go/internal/embeddedcli/embeddedcli.go:405
break
}
if err != nil {
return fmt.Errorf("reading runtime assets: %w", err)
}
if header.Typeflag != tar.TypeReg {
continue
}
clean := filepath.Clean(filepath.FromSlash(header.Name))
if !filepath.IsLocal(clean) {
return fmt.Errorf("unsafe runtime asset path %q", header.Name)
}
content, err := io.ReadAll(tarReader)
if err != nil {
return fmt.Errorf("reading runtime asset %q: %w", header.Name, err)
}
path := filepath.Join(installDir, clean)
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
return fmt.Errorf("creating runtime asset directory: %w", err)
}
hash := sha256.Sum256(content)
mode := os.FileMode(header.Mode & 0777)
if err := installVerifiedFile(path, bytes.NewReader(content), hash[:], mode, "runtime asset"); err != nil {
return err
}
}
runtimeAssetsInstalled = true
return nil
}
func validateRuntimePairConfig(wrapper io.Reader, wrapperHash []byte, node io.Reader, nodeHash []byte, prefix string) {
if (wrapper == nil) != (node == nil) {
panic(prefix + "RuntimeExecutable and " + prefix + "RuntimeNode must be provided together")
}
if wrapper == nil {
return
}View on GitHub (pinned to cd8cf15dc3)