{"record":{"id":"6c9c829cde40c633","repo":"santifer/career-ops","slug":"opening-urls-is-not-supported-on-s","errorCode":null,"errorMessage":"opening URLs is not supported on %s","messagePattern":"opening URLs is not supported on (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"dashboard/open_unsupported.go","lineNumber":11,"sourceCode":"//go:build !windows && !darwin && !linux\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n)\n\nfunc openWithDefaultApp(target string) error {\n\treturn fmt.Errorf(\"opening URLs is not supported on %s\", runtime.GOOS)\n}\n","sourceCodeStart":1,"sourceCodeEnd":13,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/dashboard/open_unsupported.go#L1-L13","documentation":"Returned by openWithDefaultApp() on operating systems the dashboard does not support for launching external apps. The file carries the build constraint `//go:build !windows && !darwin && !linux`, so it is compiled ONLY on platforms outside the supported trio (freebsd, openbsd, netbsd, solaris, dragonfly, plan9, js/wasm, etc.). On those targets the function is a permanent stub that always errors with the runtime.GOOS value; there is no xdg-open/open equivalent wired. Callers treat it as non-fatal — openCmd logs a WARN, the cover-letter handler logs a WARN, and runGeneratePDF surfaces 'PDF generated but could not open'.","triggerScenarios":"Building and running the dashboard TUI (`go run .` / the dashboard binary) on FreeBSD/OpenBSD/NetBSD/Solaris/etc., then pressing 'o' to open a job URL, 'd' to open a generated CV PDF, or triggering the cover-letter viewer. Every external-launch call site returns this error.","commonSituations":"Cross-compiling the dashboard for a BSD/Solaris target; running career-ops on a BSD workstation; CI on a non-linux Unix that builds and smoke-tests the dashboard. Not a bug — an explicit unsupported-platform guard so the build still succeeds rather than failing to link a missing OS file.","solutions":["Run the dashboard on a supported OS (linux, macOS, or windows) where openWithDefaultApp has a real implementation (xdg-open / open / cmd start).","If you must run on an unsupported OS, add a new open_<goos>.go implementing openWithDefaultApp for your platform (e.g. open_freebsd.go using xdg-open or mailto handling), satisfying the build constraint so open_unsupported.go is excluded.","Ignore the error at the call site — it is already downgraded to a WARN by openCmd/cover-letter handler; for the PDF path, the file is still generated on disk and can be opened manually from the path in the message.","As a runtime workaround, read the target path from the dashboard message and launch it yourself with your platform's opener."],"exampleFix":"// before: on FreeBSD every open* action returns this error\n//   (open_unsupported.go is the only build that matches)\n// after: add dashboard/open_freebsd.go and drop the constraint there\n//\n//   //go:build freebsd\n//   package main\n//   func openWithDefaultApp(target string) error {\n//       return runOpenCommand(\"xdg-open\", target) // or your platform's opener\n//   }\n//\n// then rebuild; open_unsupported.go is excluded once freebsd has its own file.","handlingStrategy":"validation","validationCode":"// Gate the call by build-time OS, mirroring the build constraint in the .go file.\n//go:build !windows && !darwin && !linux\npackage main\n\n// guardedOpen is a drop-in: returns a friendly message on unsupported OSes\n// instead of the raw error, and lets callers short-circuit UI actions.\nfunc canOpenExternally() bool {\n\tswitch runtime.GOOS {\n\tcase \"linux\", \"darwin\", \"windows\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n// UI gate: only wire the 'o'/'d' keys when canOpenExternally() is true.","typeGuard":null,"tryCatchPattern":"// The callers already downgrade to WARN; keep that pattern and add a pre-check\n// so the user never triggers an action that's guaranteed to fail.\nfunc openCmd(target string) tea.Cmd {\n\treturn func() tea.Msg {\n\t\tif !canOpenExternally() {\n\t\t\tfmt.Fprintf(os.Stderr, \"INFO: opening %q needs linux/macOS/windows\\n\", target)\n\t\t\treturn nil\n\t\t}\n\t\tif err := openWithDefaultApp(target); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"WARN: failed to open %q: %v\\n\", target, err)\n\t\t}\n\t\treturn nil\n\t}\n}","preventionTips":["Build/run the dashboard on linux, macOS, or windows for full open-URL/PDF support.","If shipping for a BSD/Solaris target, add an open_<goos>.go before release so the unsupported stub isn't the active build.","At call sites, check the OS before offering the 'open externally' keybind so users don't hit a guaranteed failure.","Remember the error is non-fatal by design — the PDF/file is still produced on disk even when it can't auto-open."],"tags":["go","build-constraint","cross-platform","dashboard","unsupported-os"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}