Skip to content

fix(envd): clean up error formatting when watch path is not a directory - #3582

Open
chill-czar wants to merge 1 commit into
e2b-dev:mainfrom
chill-czar:fix/envd-watch-error-formatting
Open

fix(envd): clean up error formatting when watch path is not a directory#3582
chill-czar wants to merge 1 commit into
e2b-dev:mainfrom
chill-czar:fix/envd-watch-error-formatting

Conversation

@chill-czar

@chill-czar chill-czar commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Closes #3581

Summary

  • Remove %w formatting verb on nil error in packages/envd/internal/services/filesystem/watch.go and watch_sync.go when the requested watch path is not a directory.
  • Return clean error message: path <path> is not a directory instead of path <path> not a directory: %!w(<nil>).
  • Add unit test TestCreateWatcher_NotADirectory in packages/envd/internal/services/filesystem/watch_test.go asserting clean error strings without %!w.

Why

In watch.go and watch_sync.go, when os.Stat succeeds for a non-directory path, err is nil. Calling fmt.Errorf("path %s not a directory: %w", watchPath, err) resulted in %!w(<nil>) being appended to the error string returned across the Connect-RPC wire and emitted in server logs.

Diff Overview

 	if !info.IsDir() {
-		return connect.NewError(connect.CodeInvalidArgument, fmt.Errorf("path %s not a directory: %w", watchPath, err))
+		return connect.NewError(connect.CodeInvalidArgument, fmt.Errorf("path %s is not a directory", watchPath))
 	}

Test Plan

  • Unit test: go test -v ./packages/envd/internal/services/filesystem -run TestCreateWatcher_NotADirectory
  • Package test suite passes: go test -v ./packages/envd/internal/services/filesystem/...
  • Linter & Formatter pass: make fmt and make lint
  • Verified error output contains "is not a directory" and does not contain "%!w"

/cc @jakubno @dobrac @ValentaTomas @arkamar @tvi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(envd): malformed error message %!w(<nil>) when watch path is not a directory

1 participant