{"record":{"id":"344bf89b534664f3","repo":"different-ai/openwork","slug":"openwork-server-has-no-workspace-matching-direct","errorCode":null,"errorMessage":"OpenWork server has no workspace matching ${directory}.","messagePattern":"OpenWork server has no workspace matching (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/workspace-store.mjs","lineNumber":1024,"sourceCode":"    const openworkHostUrl = remoteType === \"openwork\"\n      ? stripOpenworkWorkspaceMount(rawOpenworkHostUrl ?? baseUrl)\n      : rawOpenworkHostUrl;\n    const openworkWorkspaceId = typeof input.openworkWorkspaceId === \"string\" && input.openworkWorkspaceId.trim()\n      ? input.openworkWorkspaceId.trim()\n      : remoteType === \"openwork\"\n        ? parseOpenworkWorkspaceIdFromUrl(rawOpenworkHostUrl) || parseOpenworkWorkspaceIdFromUrl(baseUrl)\n        : null;\n    let resolvedOpenworkWorkspaceId = openworkWorkspaceId;\n    let resolvedOpenworkWorkspaceName = input.openworkWorkspaceName ?? null;\n    if (remoteType === \"openwork\" && !resolvedOpenworkWorkspaceId) {\n      const discovered = await discoverOpenworkWorkspace({\n        hostUrl: openworkHostUrl ?? baseUrl,\n        token: input.openworkToken,\n        hostToken: input.openworkHostToken,\n        directory,\n      });\n      if (!discovered?.id) {\n        throw new Error(\n          directory\n            ? `OpenWork server has no workspace matching ${directory}.`\n            : \"OpenWork server returned no workspaces.\",\n        );\n      }\n      resolvedOpenworkWorkspaceId = String(discovered.id).trim();\n      resolvedOpenworkWorkspaceName = openworkWorkspaceDisplayName(discovered);\n    }\n    const id = remoteType === \"openwork\"\n      ? openworkRemoteWorkspaceId(openworkHostUrl ?? baseUrl, resolvedOpenworkWorkspaceId)\n      : remoteWorkspaceId(baseUrl, directory);\n    const workspace = normalizeWorkspaceEntry({\n      id,\n      name: String(input.displayName ?? resolvedOpenworkWorkspaceName ?? \"Remote workspace\"),\n      displayName: input.displayName ?? null,\n      path: directory ?? \"\",\n      preset: \"remote\",\n      workspaceType: \"remote\",","sourceCodeStart":1006,"sourceCodeEnd":1042,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/workspace-store.mjs#L1006-L1042","documentation":"createWorkspaceStore resolves an OpenWork workspace by querying the server for workspaces matching a local directory. When discovery succeeds but returns no workspace whose id can be used (discovered?.id falsy) and a directory was supplied, it throws stating the server has no workspace matching that directory. This is a lookup miss, not a transport error.","triggerScenarios":"Passing input.directory (plus hostUrl/token) to workspace store creation when the OpenWork server has no workspace registered for that exact directory path.","commonSituations":"The workspace was created only locally and never registered on the server; the directory string differs in case, trailing slash, or symlinked path from what the server stores; connecting to the wrong Den org/server.","solutions":["Create the workspace on the OpenWork server for that directory, or omit/adjust directory so discovery can match.","Compare the exact directory string the server knows (path normalization, trailing slash, case) with what you pass.","Confirm you are pointed at the correct hostUrl/org that actually owns this workspace."],"exampleFix":"// before\ndirectory: \"/Users/me/project/\"  // trailing slash: no server match\n// after\ndirectory: \"/Users/me/project\"","handlingStrategy":"validation","validationCode":"const normalized = path.resolve(directory); // strip trailing separators/symlink noise\nif (!normalized || normalized === \"/\") throw new Error(\"A valid local directory is required\");\n// confirm the server knows this path before wiring the store:\nconst ws = await discoverWorkspaces({ hostUrl, token, directory: normalized });\nif (!ws?.id) throw new Error(`No server workspace for ${normalized}`);","typeGuard":"function hasDiscoveredWorkspace(d) {\n  return typeof d === \"object\" && d !== null && d.id !== undefined && d.id !== null && String(d.id).trim() !== \"\";\n}","tryCatchPattern":"try {\n  await createWorkspaceStore({ directory, openworkToken, openworkHostUrl });\n} catch (err) {\n  if (err.message.startsWith(\"OpenWork server has no workspace matching\")) {\n    // offer to create/register the workspace on the server\n  } else throw err;\n}","preventionTips":["Register the workspace on the OpenWork server before binding it locally.","Normalize the directory path (path.resolve, no trailing slash) everywhere.","Confirm the host URL points to the org that owns the workspace."],"tags":["server","workspace","lookup","configuration"],"backgroundTag":"resource-not-found","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}