{"record":{"id":"351fdb0d57209beb","repo":"wavetermdev/waveterm","slug":"error-getting-wave-file-resp-statustext","errorCode":null,"errorMessage":"error getting wave file: + resp.statusText","messagePattern":"error getting wave file: \\+ resp\\.statusText","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/app/store/global.ts","lineNumber":464,"sourceCode":"\n// when file is not found, returns {data: null, fileInfo: null}\nasync function fetchWaveFile(\n    zoneId: string,\n    fileName: string,\n    offset?: number\n): Promise<{ data: Uint8Array; fileInfo: WaveFile }> {\n    const usp = new URLSearchParams();\n    usp.set(\"zoneid\", zoneId);\n    usp.set(\"name\", fileName);\n    if (offset != null) {\n        usp.set(\"offset\", offset.toString());\n    }\n    const resp = await fetch(getWebServerEndpoint() + \"/wave/file?\" + usp.toString());\n    if (!resp.ok) {\n        if (resp.status === 404) {\n            return { data: null, fileInfo: null };\n        }\n        throw new Error(\"error getting wave file: \" + resp.statusText);\n    }\n    if (resp.status == 204) {\n        return { data: null, fileInfo: null };\n    }\n    const fileInfo64 = resp.headers.get(\"X-ZoneFileInfo\");\n    if (fileInfo64 == null) {\n        throw new Error(`missing zone file info for ${zoneId}:${fileName}`);\n    }\n    const fileInfo = JSON.parse(base64ToString(fileInfo64));\n    const data = await resp.arrayBuffer();\n    return { data: new Uint8Array(data), fileInfo };\n}\n\nfunction setNodeFocus(nodeId: string) {\n    const layoutModel = getLayoutModelForStaticTab();\n    layoutModel.focusNode(nodeId);\n}\n","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/frontend/app/store/global.ts#L446-L482","documentation":"After starting the conn controller, StartConnServer reads the first line of its output (the wsh version) via ReadLineWithTimeout with a 30-second budget. If no line arrives in time or the output stream errors, it cancels the context and returns this wrapped error. It signals the remote wsh connserver never produced its version banner, so the handshake cannot proceed.","triggerScenarios":"tryEnableWsh calls StartConnServer and ReadLineWithTimeout times out (30s) or the pipe read fails — remote wsh hung, crashed immediately, or output was never written.","commonSituations":"Old/incompatible wsh version on the WSL side that doesn't emit the version line; wsh crashed on startup inside the distro; very slow WSL boot exceeding 30s; network/transport stall between client and WSL.","solutions":["Run `wsh connserver version` (or check the wsh version) inside the WSL distro and update wsh (`wsh update`) if stale","Retry the connection — a slow WSL cold start can exceed the 30s window","Check the remote side manually: start wsh connserver inside the distro and observe its output/errors","Inspect the wrapped inner error (timeout vs read failure) to distinguish a hang from a crash"],"exampleFix":"// before\nstarted, _, _, err := conn.StartConnServer(ctx, false) // times out after 30s\n// after\n// first, inside the WSL distro:\n//   wsh conn version   -> confirm wsh installed and up to date\n//   wsh update         -> upgrade old wsh that never emits version line\nstarted, _, _, err := conn.StartConnServer(ctx, false)","handlingStrategy":"retry","validationCode":"out, _, err := genconn.RunSimpleCommand(ctx, shell, genconn.CommandSpec{Cmd: \"wsh conn version\"})\nif err != nil || strings.TrimSpace(out) == \"\" {\n    return fmt.Errorf(\"remote wsh not installed or too old: run 'wsh update' in the distro\")\n}","typeGuard":null,"tryCatchPattern":"started, _, _, err := conn.StartConnServer(ctx, false)\nif err != nil && strings.Contains(err.Error(), \"error reading wsh version\") {\n    time.Sleep(5 * time.Second)\n    started, _, _, err = conn.StartConnServer(ctx, false) // retry after slow WSL boot\n}","preventionTips":["Keep wsh up to date in all distros (`wsh update`); old versions may not emit the version line","Allow extra warm-up time after WSL cold boot before connecting","Test connserver startup manually inside the distro when handshakes stall"],"tags":["wsl","timeout","wsh-version","handshake"],"backgroundTag":"handshake-timeout","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}