anomalyco/sst · error

failed to make binary executable: %w

Error message

failed to make binary executable: %w

What it means

Right after copying the Rust binary, SST runs `os.Chmod(out, 0755)` so the `bootstrap` file is executable as a Lambda handler. This error wraps the chmod failure. Without +x the deployed Lambda cannot start, so SST fails the build early.

Source

Thrown at pkg/runtime/rust/rust.go:167

	source, err := os.Open(binary)
	if err != nil {
		return nil, fmt.Errorf("failed to open source binary: %w", err)
	}
	defer source.Close()

	destination, err := os.Create(out)
	if err != nil {
		return nil, fmt.Errorf("failed to create destination file: %w", err)
	}
	defer destination.Close()

	if _, err := io.Copy(destination, source); err != nil {
		return nil, fmt.Errorf("failed to copy binary: %w", err)
	}

	if err := os.Chmod(out, 0755); err != nil {
		return nil, fmt.Errorf("failed to make binary executable: %w", err)
	}

	return &runtime.BuildOutput{
		Handler:    "bootstrap",
		Sourcemaps: []string{},
		Errors:     []string{},
		Out:        root,
	}, nil
}

func (r *Runtime) Run(ctx context.Context, input *runtime.RunInput) (runtime.Worker, error) {
	cmd := process.Command(
		filepath.Join(input.Build.Out, input.Build.Handler),
	)
	slog.Info("running server binary", "server", input.Server)
	cmd.Env = input.Env
	cmd.Env = append(cmd.Env, "AWS_LAMBDA_RUNTIME_API=http://"+input.Server)
	cmd.Env = append(cmd.Env, "AWS_LAMBDA_FUNCTION_MEMORY_SIZE=1024")

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Build inside a filesystem that supports Unix permissions (ext4/WSL2 ext4 instead of a Windows bind mount)
  2. Run the build as the directory owner or with sufficient privileges
  3. Verify the output path exists and is on a writable, POSIX-capable filesystem
  4. Re-run the build after fixing permissions: `chmod -R u+rwX .sst`
Defensive patterns

Strategy: validation

Validate before calling

const out = path.join(functionOut, "bootstrap");
if (process.platform === "win32" && isExFATorBindMount(out)) {
  console.warn("destination FS may not support chmod 0755");
}
// after build, verify:
const mode = fs.statSync(out).mode & 0o777;
if ((mode & 0o111) === 0) throw new Error("bootstrap is not executable");

Try / catch

try {
  await run("sst", ["build"]);
} catch (e) {
  if (/failed to make binary executable/.test(String(e))) {
    throw new Error("Build FS does not support Unix permissions; build inside WSL2/ext4 or a Linux container", { cause: e });
  }
  throw e;
}

Prevention

When it happens

Trigger: `os.Chmod(out, 0755)` returns an error on the copied `bootstrap` file — typically the destination filesystem does not support permission bits (FAT32/exFAT mounts, some network shares, Windows ACL translation) or the file was deleted between copy and chmod.

Common situations: Building in a Docker bind mount on Windows or with an exFAT volume; running SST as a non-root user in a directory owned by root; tmpfs with noexec weirdness; NFS exports with `all_squash`.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/b92fb8b13e1d932c. Report an issue: GitHub.