Summary
Opening an HTML file in the Files preview panel from a "New thread" screen fails with "Unable to load file preview". The thread has not been created on the server yet. The client asks for the asset as a workspace-file keyed by the draft thread id, so the server cannot resolve the workspace.
The server already has a draft-workspace-file resource that takes cwd and path. Requesting the same file that way returns the correct content.
Environment
- T3 Code
0.0.46-nightly.20261008.2819
- Linux, server started with
t3 serve --host ..., web client in the browser
- Project with a git workspace root, file under
wireframes/*.html
Steps to reproduce
(Inferred from the screenshot and logs. I did not re-click through the UI.)
- Open a project and start a "New thread" (draft, no message sent yet).
- Open an HTML file from the workspace in the Files preview panel.
- The panel shows "Unable to load file preview".
Expected
The preview loads the file, as it does in an existing thread.
Actual
The panel shows "Unable to load file preview" with no further detail. The server trace has three ws.rpc.assets.createUrl failures within about 25 seconds, all with this cause chain:
AssetWorkspaceContextResolutionError: Failed to resolve workspace context.
[cause]: OrchestratorProjectionError: Failed to load orchestration projection for thread 276d1604-...
[cause]: ProjectionStoreThreadNotFoundError: No orchestration projection exists for thread 276d1604-...
That thread id does not exist on the server (t3_thread_read returns thread_not_found).
Diagnosis
I reproduced this outside the UI with a script that calls assets.createUrl over the WebSocket RPC. It uses a short-lived, read-only session (filesystem:read, orchestration:read), revoked afterwards. The same file gave two results:
| Resource sent |
Result |
{ _tag: "workspace-file", threadId: <draft id>, path } |
Fails with the error chain above |
{ _tag: "draft-workspace-file", cwd: <workspace root>, path } |
HTTP 200, 60131 bytes, identical to the local file |
So the file, its permissions and the signed URL are fine. The panel uses the wrong resource kind while the thread is still a draft. The assets.createUrl handler in the server bundle already has a draft-workspace-file branch that passes workspaceRoot: input.resource.cwd.
Related issues and PRs
I found no issue or PR for this case. The closest ones cover other causes:
Workaround
Open the file from an existing thread in the same project and directory.
Summary
Opening an HTML file in the Files preview panel from a "New thread" screen fails with "Unable to load file preview". The thread has not been created on the server yet. The client asks for the asset as a
workspace-filekeyed by the draft thread id, so the server cannot resolve the workspace.The server already has a
draft-workspace-fileresource that takescwdandpath. Requesting the same file that way returns the correct content.Environment
0.0.46-nightly.20261008.2819t3 serve --host ..., web client in the browserwireframes/*.htmlSteps to reproduce
(Inferred from the screenshot and logs. I did not re-click through the UI.)
Expected
The preview loads the file, as it does in an existing thread.
Actual
The panel shows "Unable to load file preview" with no further detail. The server trace has three
ws.rpc.assets.createUrlfailures within about 25 seconds, all with this cause chain:That thread id does not exist on the server (
t3_thread_readreturnsthread_not_found).Diagnosis
I reproduced this outside the UI with a script that calls
assets.createUrlover the WebSocket RPC. It uses a short-lived, read-only session (filesystem:read,orchestration:read), revoked afterwards. The same file gave two results:{ _tag: "workspace-file", threadId: <draft id>, path }{ _tag: "draft-workspace-file", cwd: <workspace root>, path }So the file, its permissions and the signed URL are fine. The panel uses the wrong resource kind while the thread is still a draft. The
assets.createUrlhandler in the server bundle already has adraft-workspace-filebranch that passesworkspaceRoot: input.resource.cwd.Related issues and PRs
I found no issue or PR for this case. The closest ones cover other causes:
draft-workspace-fileresourceWorkaround
Open the file from an existing thread in the same project and directory.