{"record":{"id":"8795c1f3aeb9a7d7","repo":"sinelaw/fresh","slug":"unknown-dock-view-view","errorCode":null,"errorMessage":"unknown dock view: ${view}","messagePattern":"unknown dock view: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/fresh-editor/plugins/orchestrator.ts","lineNumber":10760,"sourceCode":"      }\n      if (e.label === want && (!match || e.archived_at > match.archived_at)) {\n        match = e;\n      }\n    }\n    if (match && match.root === want) break;\n  }\n  if (!match) return false;\n  const res = await unarchiveOne(match);\n  if (!res.ok) throw new Error(res.err || \"unarchive failed\");\n  // The manifest changed, so push it the same way the archive path does.\n  if (res.repoRoot) triggerSyncAsync(res.repoRoot);\n  refreshOpenDialog();\n  return true;\n}\n\nfunction apiSetDockView(view: \"card\" | \"compact\"): void {\n  if (view !== \"card\" && view !== \"compact\") {\n    throw new Error(`unknown dock view: ${view}`);\n  }\n  dockView = view;\n  // Pin it for the rest of the session, exactly as the toolbar's \"view\"\n  // button does — the `defaultView` setting only decides where the dock\n  // *starts*, so without the override a later re-open would undo this.\n  dockViewOverride = view;\n  refreshOpenDialog();\n}\n\nfunction apiSetDockFilter(\n  options: DockFilterOptions = {},\n  // Internal, and deliberately absent from the published signature: set when\n  // the call comes from the filter box's own `change` event. The box already\n  // holds the text and owns the caret, so the value must not be pushed back\n  // (that would move the caret to the end and make mid-string editing jump).\n  fromWidget?: { cursorByte?: number },\n): void {\n  // The row the user is looking at, so it can be kept highlighted across the","sourceCodeStart":10742,"sourceCodeEnd":10778,"githubUrl":"https://github.com/sinelaw/fresh/blob/67894ca5463dbd7a89bb31add4627c27d6b79d83/crates/fresh-editor/plugins/orchestrator.ts#L10742-L10778","documentation":"apiSetDockView sets the orchestrator dock's view mode and only accepts the two supported values \"card\" and \"compact\". Any other string (or non-string value) fails the whitelist check and the function throws immediately, before mutating dockView. The dock view is a session-pinned setting, so the guard prevents persisting an invalid mode.","triggerScenarios":"Calling the plugin API apiSetDockView (exposed as the dock's setView / 'view' API in orchestrator.ts:10760) with any value other than exactly \"card\" or \"compact\" — e.g. \"list\", \"grid\", \"Card\", \"\", or a number.","commonSituations":"Plugin or script authors guessing at view names instead of using the documented two; case-sensitivity mistakes (\"Card\"); config values wired in from settings that were never validated; passing user input straight through from a custom command palette entry.","solutions":["Use only \"card\" or \"compact\" as the argument.","Validate/normalize the value (trim, lowercase) before calling apiSetDockView.","If the value comes from a settings file, fix the setting to one of the two allowed values.","If a third view mode is genuinely needed, extend the union type and the guard in apiSetDockView rather than passing an unlisted string."],"exampleFix":"// before\neditor.setDockView(\"list\");\n\n// after\nconst view = \"list\";\nif (view === \"card\" || view === \"compact\") {\n  editor.setDockView(view);\n} else {\n  editor.setDockView(\"card\");\n}","handlingStrategy":"validation","validationCode":"const VIEWS = [\"card\", \"compact\"];\nfunction canSetDockView(v) {\n  return typeof v === \"string\" && VIEWS.includes(v);\n}","typeGuard":"function isDockView(v: unknown): v is \"card\" | \"compact\" {\n  return v === \"card\" || v === \"compact\";\n}","tryCatchPattern":"try {\n  editor.setDockView(view);\n} catch (e) {\n  if (String(e.message).startsWith(\"unknown dock view\")) {\n    editor.setDockView(\"card\"); // safe default\n  } else throw e;\n}","preventionTips":["Only pass the literal values \"card\" or \"compact\" to setDockView.","Normalize external input (trim + lowercase) before mapping it to a dock view.","Validate settings/config values that feed the dock view at load time.","Prefer the TypeScript union type \"card\" | \"compact\" so invalid values fail at compile time."],"tags":["invalid-enum-value","plugin-api","ui-config"],"backgroundTag":"invalid-enum-value","analyzedSha":"67894ca5463dbd7a89bb31add4627c27d6b79d83","analyzedAt":"2026-09-13T15:04:03.701Z","contentChangedAt":"2026-09-13T15:04:03.701Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}