{"record":{"id":"2ebd96a2dd6e89ce","repo":"wavetermdev/waveterm","slug":"error-listing-blockfiles-w","errorCode":null,"errorMessage":"error listing blockfiles: %w","messagePattern":"error listing blockfiles: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshrpc/wshserver/wshserver.go","lineNumber":821,"sourceCode":"\t}\n}\n\nfunc (ws *WshServer) BlockInfoCommand(ctx context.Context, blockId string) (*wshrpc.BlockInfoData, error) {\n\tblockData, err := wstore.DBMustGet[*waveobj.Block](ctx, blockId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting block: %w\", err)\n\t}\n\ttabId, err := wstore.DBFindTabForBlockId(ctx, blockId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error finding tab for block: %w\", err)\n\t}\n\tworkspaceId, err := wstore.DBFindWorkspaceForTabId(ctx, tabId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error finding window for tab: %w\", err)\n\t}\n\tfileList, err := filestore.WFS.ListFiles(ctx, blockId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing blockfiles: %w\", err)\n\t}\n\tvar fileInfoList []*wshrpc.WaveFileInfo\n\tfor _, wf := range fileList {\n\t\tfileInfoList = append(fileInfoList, waveFileToWaveFileInfo(wf))\n\t}\n\treturn &wshrpc.BlockInfoData{\n\t\tBlockId:     blockId,\n\t\tTabId:       tabId,\n\t\tWorkspaceId: workspaceId,\n\t\tBlock:       blockData,\n\t\tFiles:       fileInfoList,\n\t}, nil\n}\n\nfunc (ws *WshServer) DebugTermCommand(ctx context.Context, data wshrpc.CommandDebugTermData) (*wshrpc.CommandDebugTermRtnData, error) {\n\tif data.BlockId == \"\" {\n\t\treturn nil, fmt.Errorf(\"blockid is required\")\n\t}","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshrpc/wshserver/wshserver.go#L803-L839","documentation":"Finally, BlockInfoCommand lists the block's files via filestore.WFS.ListFiles (the block's virtual filesystem). This error wraps failure of that listing — the blockfile store could not enumerate files for the blockId. Block metadata gathering fails even though block/tab/workspace lookups succeeded.","triggerScenarios":"Calling BlockInfoCommand when the block's WFS (wavefs) backend errors: underlying file storage failure, permission problems on the blockfile directory, cloud/filestore backend unavailability, or blockId having no valid filestore zone.","commonSituations":"Disk full or permission-denied on the local wave data directory; remote filestore backend unreachable; corrupted blockfile directory; running with a different user than the one that owns the wave storage.","solutions":["Check the wrapped cause for filesystem errors (EACCES, ENOSPC, ENOENT).","Verify the wave data directory (~/.waveterm/blockstore or equivalent) is readable/writable and has free space.","Retry the command; transient filestore/cloud errors may resolve.","If the blockfile zone is corrupted, remove/recreate the block's files or restore from backup."],"exampleFix":"// before\ninfo, err := wshclient.BlockInfoCommand(ctx, blockId, nil) // ENOSPC on blockfile dir\n// after\nif info, err := wshclient.BlockInfoCommand(ctx, blockId, nil); err != nil {\n    // fall back to metadata without file list\n    info = &wshrpc.BlockInfoData{BlockId: blockId, MetaOnly: true}\n}\n_ = info","handlingStrategy":"fallback","validationCode":"// cheap pre-check of the blockfile dir\nif fi, err := os.Stat(blockStoreDir); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"blockfile storage unavailable: %w\", err)\n}","typeGuard":"func isFileStoreFailure(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"error listing blockfiles\")\n}","tryCatchPattern":"info, err := wshclient.BlockInfoCommand(ctx, blockId, nil)\nif err != nil {\n    if isFileStoreFailure(err) {\n        // degrade gracefully: render block metadata without file list\n        return &partialInfo{blockId: blockId, reason: err}, nil\n    }\n    return err\n}","preventionTips":["Monitor disk space and permissions on the wave data directory","Retry transient filestore/cloud backend errors with backoff","Keep the app running as the user that owns the storage dir","Back up and repair corrupted blockfile zones"],"tags":["filestore","blockfiles","rpc"],"backgroundTag":"file-listing-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}