sinelaw/fresh · error
workspace is still being created and cannot be
Error message
workspace is still being created and cannot be ${verb} What it means
This error is thrown by rejectPending() when an operation is attempted against an agent session that is still being created: it has a pending placeholder state but no durable stableId yet. A stableId is assigned once the session's window/build settles, so any verb (rename, file-into-folder, etc.) called before that would have nothing durable to operate on. The library refuses the call instead of silently applying it to a session that may be replaced by the pending build.
Solutions
- Wait for workspace creation to complete (await the create call or poll until the session has a stableId) before invoking further verbs
- Retry the operation after the creation/build event fires; the same call succeeds once stableId is assigned
- If it's a local create, ensure the stableId path is used — local placeholders carry their durable id from birth, so only remote/abnormal flows should hit this
Example fix
// before api.assignSessionToFolder(newWs.id, folderId); // after await orchestrator.waitForWorkspaceReady(newWs.id); api.assignSessionToFolder(newWs.id, folderId);
Defensive patterns
Strategy: retry
Validate before calling
const ready = (ws) => ws && ws.stableId != null && !ws.pending; if (!ready(api.getWorkspace(id))) await waitForReady(id);
Type guard
function isSessionReady(s) {
return s != null && !s.pending && typeof s.stableId === "string" && s.stableId.length > 0;
} Try / catch
try {
api.renameWorkspace(id, name);
} catch (e) {
if (String(e).includes("still being created")) {
await waitForWorkspaceReady(id);
api.renameWorkspace(id, name);
} else throw e;
} Prevention
- Always await the workspace create call before issuing follow-up verbs
- Gate follow-up operations on the presence of stableId
- Subscribe to the creation-complete/build event instead of polling blindly
- In tests, use the harness's readiness helper rather than fixed timeouts
When it happens
Trigger: Calling an orchestrator API (e.g. rename or assign-session-to-folder) against a workspace whose session record is a pending placeholder without a stableId — typically a remote create whose window is born by the connect step, or any call racing the workspace creation build.
Common situations: Automated scripts that create a workspace and immediately rename or file it without waiting for creation to complete; event handlers reacting to a session-appearing event fired before the build finishes; tests that don't await workspace readiness.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- workspace has no agent process to stop
- workspace cannot be
- no such folder
- folder name must not be empty
- no such folder
AI-assisted analysis of sinelaw/fresh@67894ca546 (2026-09-13).
Data as JSON: /api/errors/75a65d60c9d15414.
Report an issue: GitHub.
Appendix: source
Thrown at crates/fresh-editor/plugins/orchestrator.ts:10576
if (stable === target) return session;
}
return null;
}
/// A workspace still being created has no durable identity and no worktree
/// yet — the dock offers it Retry / Dismiss and nothing else, so the verbs
/// that organise a *real* workspace refuse it here rather than writing a name
/// or a folder assignment against a placeholder key that is about to vanish.
// Guard the verbs that need somewhere durable to record their result.
//
// A workspace still being created keys its name and its folder off the
// durable `stableId` it was born with, so both survive the build and both
// are safe to set while it runs. A *windowless* placeholder (a remote
// create, whose window is born by the connect) has no such id yet — there
// is nothing to file the change against, so it is still refused.
function rejectPending(s: AgentSession, verb: string): void {
if (s.pending && !s.stableId) {
throw new Error(`workspace is still being created and cannot be ${verb}`);
}
}
/// Push folder-tree changes into an open dock. The tree's expansion set is
/// host-owned state seeded from the plugin's persisted set, so a folder
/// created or deleted behind the dock's back has to be re-seeded before the
/// re-render — the same two steps `submitCreateFolder` runs.
function refreshDockTree(): void {
if (openPanel && dockMode) {
openPanel.setExpandedKeys("sessions", Array.from(loadExpanded()));
}
refreshOpenDialog();
}
function apiRenameWorkspace(target: string | number, name?: string): boolean {
const s = resolveWorkspace(target);
if (!s) return false;
rejectPending(s, "renamed");View on GitHub (pinned to 67894ca546)