Skip to content

[Bug]: container system start crashes with fatal error when app-root directory is not writable #1802

Description

@kapil971390

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

  1. Build from source on main (1d70dd6):
    rm -rf test-data && make APP_ROOT=test-data all
    
  2. Create a read-only app-root directory:
    mkdir -p /tmp/test-approot && chmod 555 /tmp/test-approot
    
  3. Run:
    bin/container system start --app-root /tmp/test-approot
    

Current behavior

The process crashes with a fatal error and exit code 133:

ContainerCommands/SystemStart.swift:107: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=513 "You don't have permission to save the file "apiserver" in the folder "test-approot"." UserInfo={NSFilePath=/tmp/test-approot/apiserver, NSURL=file:///tmp/test-approot/apiserver, NSUnderlyingError=0x10836cbc0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}

The crash is at line 107 of SystemStart.swift — a try! on FileManager.default.createDirectory. run() is already async throws, and every other call in the same function uses plain try and propagates errors normally. This one line does not.

Expected behavior

container system start should surface a clear error and exit cleanly — the same way every other failure in run() does.

Relevant log output

ContainerCommands/SystemStart.swift:107: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=513 "You don't have permission to save the file "apiserver" in the folder "test-approot"." UserInfo={NSFilePath=/tmp/test-approot/apiserver, NSURL=file:///tmp/test-approot/apiserver, NSUnderlyingError=0x10836cbc0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}

Environment

  • OS: macOS 26.5.1 (25F80)
  • Xcode: Version 26.0 (17A324)
  • Swift: Apple Swift version 6.2.4 (swiftlang-6.2.4.1.4 clang-1700.6.4.2)
  • Commit: 1d70dd6 (main)
  • Build: debug (make APP_ROOT=test-data all)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions