{"record":{"id":"d51cb2b64bc16032","repo":"wavetermdev/waveterm","slug":"error-reading-term-file-w","errorCode":null,"errorMessage":"error reading term file: %w","messagePattern":"error reading term file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshrpc/wshserver/wshserver.go","lineNumber":858,"sourceCode":"\tif data.Size <= 0 {\n\t\treturn nil, fmt.Errorf(\"size must be greater than 0\")\n\t}\n\twaveFile, err := filestore.WFS.Stat(ctx, data.BlockId, wavebase.BlockFile_Term)\n\tif err == fs.ErrNotExist {\n\t\treturn &wshrpc.CommandDebugTermRtnData{}, nil\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error statting term file: %w\", err)\n\t}\n\treadSize := data.Size\n\tdataLength := waveFile.DataLength()\n\tif readSize > dataLength {\n\t\treadSize = dataLength\n\t}\n\treadOffset := waveFile.Size - readSize\n\treadOffset, readData, err := filestore.WFS.ReadAt(ctx, data.BlockId, wavebase.BlockFile_Term, readOffset, readSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading term file: %w\", err)\n\t}\n\treturn &wshrpc.CommandDebugTermRtnData{\n\t\tOffset: readOffset,\n\t\tData64: base64.StdEncoding.EncodeToString(readData),\n\t}, nil\n}\n\nfunc (ws *WshServer) WaveInfoCommand(ctx context.Context) (*wshrpc.WaveInfoData, error) {\n\treturn &wshrpc.WaveInfoData{\n\t\tVersion:   wavebase.WaveVersion,\n\t\tClientId:  wstore.GetClientId(),\n\t\tBuildTime: wavebase.BuildTime,\n\t\tConfigDir: wavebase.GetWaveConfigDir(),\n\t\tDataDir:   wavebase.GetWaveDataDir(),\n\t}, nil\n}\n\nfunc (ws *WshServer) MacOSVersionCommand(ctx context.Context) (string, error) {","sourceCodeStart":840,"sourceCodeEnd":876,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshrpc/wshserver/wshserver.go#L840-L876","documentation":"Returned when reading the term file (terminal capture file) fails, e.g. it does not exist or is unreadable. The underlying error is wrapped with %w.","triggerScenarios":"WFS.ReadAt fails while reading the requested tail range of the terminal debug file (storage backend error, IO failure, data unavailable).","commonSituations":"Storage corruption of the block's term data; transient IO errors on the backing store; permission issues on the storage layer.","solutions":["Inspect the wrapped underlying error for the root cause","Retry the call if the failure is transient","Verify the block's term file data is intact (Stat succeeds but ReadAt fails indicates data-level corruption)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var resp *wshrpc.CommandDebugTermRtnData\nvar err error\nfor i := 0; i < 3; i++ {\n    resp, err = client.DebugTermCommand(ctx, data)\n    if err == nil || !strings.Contains(err.Error(), \"error reading term file\") {\n        break\n    }\n    time.Sleep(100 * time.Millisecond)\n}","preventionTips":["Retry transient IO failures with backoff","Alert on repeated read failures (may indicate corruption)","Keep block term files within expected size bounds"],"tags":["filestore","storage","rpc","io-error"],"backgroundTag":"file-read-failure","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}