wavetermdev/waveterm · error

error listing blockfiles: %w

Error message

error listing blockfiles: %w

What it means

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.

Source

Thrown at pkg/wshrpc/wshserver/wshserver.go:821

	}
}

func (ws *WshServer) BlockInfoCommand(ctx context.Context, blockId string) (*wshrpc.BlockInfoData, error) {
	blockData, err := wstore.DBMustGet[*waveobj.Block](ctx, blockId)
	if err != nil {
		return nil, fmt.Errorf("error getting block: %w", err)
	}
	tabId, err := wstore.DBFindTabForBlockId(ctx, blockId)
	if err != nil {
		return nil, fmt.Errorf("error finding tab for block: %w", err)
	}
	workspaceId, err := wstore.DBFindWorkspaceForTabId(ctx, tabId)
	if err != nil {
		return nil, fmt.Errorf("error finding window for tab: %w", err)
	}
	fileList, err := filestore.WFS.ListFiles(ctx, blockId)
	if err != nil {
		return nil, fmt.Errorf("error listing blockfiles: %w", err)
	}
	var fileInfoList []*wshrpc.WaveFileInfo
	for _, wf := range fileList {
		fileInfoList = append(fileInfoList, waveFileToWaveFileInfo(wf))
	}
	return &wshrpc.BlockInfoData{
		BlockId:     blockId,
		TabId:       tabId,
		WorkspaceId: workspaceId,
		Block:       blockData,
		Files:       fileInfoList,
	}, nil
}

func (ws *WshServer) DebugTermCommand(ctx context.Context, data wshrpc.CommandDebugTermData) (*wshrpc.CommandDebugTermRtnData, error) {
	if data.BlockId == "" {
		return nil, fmt.Errorf("blockid is required")
	}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check the wrapped cause for filesystem errors (EACCES, ENOSPC, ENOENT).
  2. Verify the wave data directory (~/.waveterm/blockstore or equivalent) is readable/writable and has free space.
  3. Retry the command; transient filestore/cloud errors may resolve.
  4. If the blockfile zone is corrupted, remove/recreate the block's files or restore from backup.

Example fix

// before
info, err := wshclient.BlockInfoCommand(ctx, blockId, nil) // ENOSPC on blockfile dir
// after
if info, err := wshclient.BlockInfoCommand(ctx, blockId, nil); err != nil {
    // fall back to metadata without file list
    info = &wshrpc.BlockInfoData{BlockId: blockId, MetaOnly: true}
}
_ = info
Defensive patterns

Strategy: fallback

Validate before calling

// cheap pre-check of the blockfile dir
if fi, err := os.Stat(blockStoreDir); err != nil || !fi.IsDir() {
    return fmt.Errorf("blockfile storage unavailable: %w", err)
}

Type guard

func isFileStoreFailure(err error) bool {
    return err != nil && strings.Contains(err.Error(), "error listing blockfiles")
}

Try / catch

info, err := wshclient.BlockInfoCommand(ctx, blockId, nil)
if err != nil {
    if isFileStoreFailure(err) {
        // degrade gracefully: render block metadata without file list
        return &partialInfo{blockId: blockId, reason: err}, nil
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/2ebd96a2dd6e89ce. Report an issue: GitHub.