Confusing error when "dir" is wrong #6

Open
opened 2026-01-09 02:28:19 +00:00 by scott · 1 comment
Owner

If I run a Rhai script with a bad "dir" parameter:

// Create a simple service that runs a command
zinit_service_new()
    .name("hello_world")
    .exec("/bin/echo 'Hello from zinit!'")
    .dir("/does/not/exist") // Invalid dir!
    .oneshot(true) 
    .register();

// Start it
zinit_start("hello_world");

When I run it I see this error:

Starting hello_world service...
zinit: ERROR (zinit_server::zinit::lifecycle) service hello_world failed to start: cannot run '/bin/echo': program not found, check it exists and is executable
Started: hello_world
zinit: ERROR (zinit_server::zinit::lifecycle) service hello_world failed to start: cannot run '/bin/echo': program not found, check it exists and is executable
Service state: Failure

Service output:
  hello_world: ERROR: cannot run '/bin/echo': program not found, check it exists and is executable
  hello_world: ERROR: cannot run '/bin/echo': program not found, check it exists and is executable

Of course that's confusing. Would be better to validate the dir and throw a helpful error.

If I run a Rhai script with a bad "dir" parameter: ```rust // Create a simple service that runs a command zinit_service_new() .name("hello_world") .exec("/bin/echo 'Hello from zinit!'") .dir("/does/not/exist") // Invalid dir! .oneshot(true) .register(); // Start it zinit_start("hello_world"); ``` When I run it I see this error: ``` Starting hello_world service... zinit: ERROR (zinit_server::zinit::lifecycle) service hello_world failed to start: cannot run '/bin/echo': program not found, check it exists and is executable Started: hello_world zinit: ERROR (zinit_server::zinit::lifecycle) service hello_world failed to start: cannot run '/bin/echo': program not found, check it exists and is executable Service state: Failure Service output: hello_world: ERROR: cannot run '/bin/echo': program not found, check it exists and is executable hello_world: ERROR: cannot run '/bin/echo': program not found, check it exists and is executable ``` Of course that's confusing. Would be better to validate the dir and throw a helpful error.
Author
Owner

Seems this also happens if the program exits with an error. Too many errors are getting caught at the same place.

Seems this also happens if the program exits with an error. Too many errors are getting caught at the same place.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
geomind_code/zinit_archive#6
No description provided.