{"record":{"id":"05e2432a1e778308","repo":"anomalyco/sst","slug":"failed-to-create-destination-file-w-05e243","errorCode":null,"errorMessage":"failed to create destination file: %w","messagePattern":"failed to create destination file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/rust/rust.go","lineNumber":158,"sourceCode":"\t\t}[input.Dev],\n\t)\n\tout := filepath.Join(input.Out(), \"bootstrap\")\n\n\tr.directories[input.FunctionID], _ = filepath.Abs(root)\n\n\tif err := os.MkdirAll(filepath.Dir(out), 0755); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create output directory: %w\", err)\n\t}\n\n\tsource, err := os.Open(binary)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open source binary: %w\", err)\n\t}\n\tdefer source.Close()\n\n\tdestination, err := os.Create(out)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create destination file: %w\", err)\n\t}\n\tdefer destination.Close()\n\n\tif _, err := io.Copy(destination, source); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to copy binary: %w\", err)\n\t}\n\n\tif err := os.Chmod(out, 0755); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to make binary executable: %w\", err)\n\t}\n\n\treturn &runtime.BuildOutput{\n\t\tHandler:    \"bootstrap\",\n\t\tSourcemaps: []string{},\n\t\tErrors:     []string{},\n\t\tOut:        root,\n\t}, nil\n}","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/rust/rust.go#L140-L176","documentation":"Rust runtime Build creates the destination bootstrap file inside the bundle with os.Create and wraps failures with this message. Both the output directory and the source binary were fine, but creating the destination file failed — destination is a directory, permissions deny write, or the filesystem is full.","triggerScenarios":"os.Create(out) errors where out = filepath.Join(input.Out(), \"bootstrap\"): a directory named `bootstrap` already exists in the output, the output dir is unwritable for the current user, or the volume is out of space/inodes.","commonSituations":"Previous failed deploy left `bootstrap` as a directory; running in a rootless container with a read-only bundle mount; disk quota exhausted on the build output volume.","solutions":["Remove any directory/file named `bootstrap` blocking the output path","Check free space and write permissions on the function output directory","Redeploy after clearing the corrupted .sst output for that function","Inspect the wrapped os error text for the exact underlying cause"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const bootstrap = path.join(outDir, \"bootstrap\")\nif (fs.existsSync(bootstrap)) fs.rmSync(bootstrap, { recursive: true })\nfs.accessSync(outDir, fs.constants.W_OK)","typeGuard":null,"tryCatchPattern":"if err := sstDeploy(); err != nil {\n\tif strings.Contains(err.Error(), \"failed to create destination file\") {\n\t\t// remove stale 'bootstrap' entry / free space, then redeploy\n\t}\n}","preventionTips":["Remove stale `bootstrap` artifacts from failed deploys","Keep free space/inodes on the build output volume","Deploy with a user that owns the output directory","Avoid read-only mounts for the bundle output path"],"tags":["go","rust","filesystem","build"],"backgroundTag":"destination-file-create-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}