Skip to content

[Bug]: Missing optional t3.json logs WorkspaceFileSystem error on every read #16318

Closed

Description

@dataforxyz

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Open a workspace whose root has no t3.json.
  2. Open a UI surface that checks for project scripts (for example, the project actions/settings or thread details scripts menu).
  3. Observe the server log when T3 Code requests t3.json through projects.readFile.

Expected behavior

A missing optional t3.json is treated as “not present” without logging a filesystem error stack. Other failures (such as permission errors) should still be reported.

Actual behavior

The request fails during realpath-target with ENOENT and emits a WorkspaceFileSystemOperationError stack. Repeated checks make the logs noisy even though this file is optional.

Impact

Minor bug or occasional failure

Version or commit

Linux AppImage nightly 0.0.46-nightly.20261005.2689

Environment

Linux desktop, T3 Code AppImage nightly.

Logs or stack traces

WorkspaceFileSystemOperationError: Workspace file operation 'realpath-target' failed at '<workspace>/t3.json' for resolved path '<workspace>/t3.json' (requested as 't3.json' in '<workspace>')
[cause]: Error: ENOENT: no such file or directory, realpath '<workspace>/t3.json'
...
WorkspaceFileSystem.readFile
ws.rpc.projects.readFile

Screenshots, recordings, or supporting files

Not applicable.

Workaround

No project workaround identified. Adding an empty t3.json would mask the missing-file error but is not appropriate when the repository has no T3 project configuration.

Activity

  1. juliusmarminge commented on Oct 6, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Triage

    Thanks for the clear report, @dataforxyz! This lines up with what we see on current main.

    What I found

    • t3.json is optional, and T3ProjectFileLoader already returns "none" on NotFound, only warning when the file exists but can't be read or decoded.
    • The client doesn't go through that loader. It calls projects.readFile for t3.json from the thread details panel (whenever a project is open), project settings (importable scripts and the settings inheritance chain), and new-thread defaults when no higher-priority env mode is set.
    • WorkspaceFileSystem.readFile resolves the path with realpath, so a missing file becomes WorkspaceFileSystemOperationError (realpath-target, ENOENT). That's mapped to ProjectReadFileError with failure: "operation_failed", and observeRpcEffect records the ws.rpc.projects.readFile span as failed in server.trace.ndjson. Those spans then show up in Settings → Diagnostics as latest and common failures, which matches the message you quoted.
    • It isn't a crash or an unbounded loop. The projects.readFile query is cached for 30 seconds, so each surface produces about one failure per project per stale window. Repos without a t3.json are the common case, though, so the noise adds up.

    Likely fix area

    A few options:

    • Treat absence as a successful "not present" result specifically on the optional t3.json read, while a file that exists but can't be read or decoded stays an error.
    • Route the client's t3.json reads through the same not-found handling T3ProjectFileLoader already uses.

    Swallowing ENOENT inside the generic readFile looks less attractive, since explicitly opening a missing file should still fail (WorkspaceFileSystem.test.ts covers that for missing.txt). A server-side negative cache alone wouldn't help either, because the failure span is written on the first request.

    A maintainer will decide on the fix direction.

  2. added
    bug
    via-triage
    on Oct 6, 2026
  3. rahul05ranjan commented on Oct 6, 2026

    @rahul05ranjan

    I traced the current path: the scripts UI calls useProjectFileQuery() for t3.json. For an absent file, WorkspaceFileSystem.resolveReadTarget() wraps realpath's ENOENT as WorkspaceFileSystemOperationError; the projects.readFile RPC then maps that to ProjectReadFileError with failure: "operation_failed" and the original cause. The UI already treats a settled read with no contents as missing.

    That makes the missing optional file look like an I/O failure at the RPC boundary even though the UI expects it. A narrow fix would give ENOENT its own missing-file result or failure there, while preserving operation_failed for permission and other real I/O errors. I haven't changed the shared read API because other file reads rely on its current error behavior.

  4. t3-code-bot commented on Oct 21, 2026

    @t3-code-bot
    Contributor

    closing as addressed by #19949, merged into main: optional t3.json reads return a successful absent result rather than failed filesystem/RPC spans. Genuine read errors and workspace containment checks remain intact.

    thanks for reporting this. if you still face it on a build containing this fix, please ask us to reopen this issue or open a new issue linking back here, with your version, os and reproduction steps.

    closed at the request of @UtkarshUsername.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugvia-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions