{"record":{"id":"3a0396d09e7ac78b","repo":"NousResearch/hermes-agent","slug":"r-couldnotpreview-path","errorCode":null,"errorMessage":"r.couldNotPreview(path)","messagePattern":"r\\.couldNotPreview\\(path\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/desktop/src/app/right-sidebar/index.tsx","lineNumber":66,"sourceCode":"    rootError,\n    rootLoading,\n    setNodeOpen\n  } = useProjectTree(hasWorkspace ? currentCwd : '')\n\n  const cwdName =\n    effectiveCwd\n      .split(/[\\\\/]+/)\n      .filter(Boolean)\n      .pop() ?? effectiveCwd\n\n  const canCollapse = Object.values(openState).some(Boolean)\n\n  const previewFile = async (path: string) => {\n    try {\n      const preview = await normalizeOrLocalPreviewTarget(path, effectiveCwd || undefined)\n\n      if (!preview) {\n        throw new Error(r.couldNotPreview(path))\n      }\n\n      openPreview(preview, 'file-browser')\n    } catch (error) {\n      notifyError(error, r.previewUnavailable)\n    }\n  }\n\n  return (\n    <aside\n      aria-label={r.aria}\n      className={cn(\n        'before:pointer-events-none relative flex h-full w-full min-w-0 flex-col overflow-hidden border-(--ui-stroke-secondary) bg-(--ui-sidebar-surface-background) pt-(--titlebar-height) text-(--ui-text-tertiary)',\n        panesFlipped\n          ? 'border-r shadow-[inset_-0.0625rem_0_0_color-mix(in_srgb,white_18%,transparent)]'\n          : 'border-l shadow-[inset_0.0625rem_0_0_color-mix(in_srgb,white_18%,transparent)]'\n      )}\n    >","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/apps/desktop/src/app/right-sidebar/index.tsx#L48-L84","documentation":"Thrown by the right sidebar file browser's previewFile handler in the desktop app. It resolves a clicked file path against the session's effective cwd via normalizeOrLocalPreviewTarget; a null result means the path cannot be turned into any previewable target (unsupported scheme, unreachable location, unresolvable relative path). The catch converts it into an error notification, so it signals 'this file cannot be previewed from here' rather than crashing.","triggerScenarios":"Clicking a file in the browser tree that is a directory-like entry or unsupported type, a path on a remote backend unreachable from the client, a relative path that fails to anchor because effectiveCwd is empty, or a file deleted between listing and click.","commonSituations":"Desktop app over SSH/URL backend where the file tree reflects the backend filesystem; workspace roots with symlinks the resolver refuses; empty-cwd sessions (brand-new session before cwd sync).","solutions":["Confirm effectiveCwd is set for the session so relative paths resolve; reopen the workspace if cwd is empty.","For remote backends, preview only files accessible from the client (mounted path or served URL).","Refresh the file browser if the file may have been deleted or moved.","As a developer: pre-filter browser entries with a canPreview check so unpreviewable entries are not clickable."],"exampleFix":"// before\nconst preview = await normalizeOrLocalPreviewTarget(path, effectiveCwd || undefined)\nif (!preview) {\n  throw new Error(r.couldNotPreview(path))\n}\n\n// after — only enable preview for entries the resolver will accept\nconst preview = await normalizeOrLocalPreviewTarget(path, effectiveCwd || undefined)\nif (!preview) {\n  notifyError(new Error(r.couldNotPreview(path)), r.previewUnavailable)\n  return\n}","handlingStrategy":"try-catch","validationCode":"const canPreview = (p: string) => p.startsWith('/') || p.startsWith('http') || Boolean(effectiveCwd)\nif (!canPreview(path)) return","typeGuard":"const isLocallyResolvable = (p: string, cwd?: string): boolean =>\n  p.startsWith('/') || /^https?:/.test(p) || Boolean(cwd && !p.startsWith('\\\\\\\\'))","tryCatchPattern":"try {\n  const preview = await normalizeOrLocalPreviewTarget(path, effectiveCwd || undefined)\n  if (!preview) throw new Error(r.couldNotPreview(path))\n  openPreview(preview, 'file-browser')\n} catch (error) {\n  notifyError(error, r.previewUnavailable) // toast, tree stays usable\n}","preventionTips":["Keep session cwd synced so relative paths resolve","Grey out unpreviewable entries in the tree instead of failing on click","Refresh the tree when underlying files change"],"tags":["desktop","preview","file-browser","filesystem"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}