wavetermdev/waveterm · error

error creating block term file: %w

Error message

error creating block term file: %w

What it means

When starting a fresh durable shell (no existing jobId), Start creates the block's circular term output file via filestore.WFS.MakeFile. This error wraps any filestore failure other than fs.ErrExist (which is tolerated since the file may already exist).

Source

Thrown at pkg/blockcontroller/durableshellcontroller.go:170

		if err != nil {
			return fmt.Errorf("error getting job manager status: %w", err)
		}
		if status == jobcontroller.JobManagerStatus_Running {
			jobId = blockData.JobId
		} else if !force {
			log.Printf("block %q has jobId %s but manager is not running (status: %s), not starting (force=false)\n", dsc.BlockId, blockData.JobId, status)
			return nil
		} else {
			log.Printf("block %q has jobId %s but manager is not running (status: %s), starting new job (force=true)\n", dsc.BlockId, blockData.JobId, status)
			// intentionally leave jobId empty to trigger starting a new job below
		}
	}

	if jobId == "" {
		log.Printf("block %q starting new durable shell\n", dsc.BlockId)
		fsErr := filestore.WFS.MakeFile(ctx, dsc.BlockId, wavebase.BlockFile_Term, nil, wshrpc.FileOpts{MaxSize: DefaultTermMaxFileSize, Circular: true})
		if fsErr != nil && fsErr != fs.ErrExist {
			return fmt.Errorf("error creating block term file: %w", fsErr)
		}
		newJobId, err := dsc.startNewJob(ctx, blockMeta, dsc.ConnName, rtOpts)
		if err != nil {
			return fmt.Errorf("failed to start new job: %w", err)
		}
		jobId = newJobId
	}

	dsc.WithLock(func() {
		dsc.JobId = jobId
		dsc.sendUpdate_withlock()
	})

	err = jobcontroller.ReconnectJob(ctx, jobId, rtOpts)
	if err != nil {
		return fmt.Errorf("failed to reconnect to job: %w", err)
	}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check free disk space and permissions on the wave data directory
  2. Verify the remote connection/filestore is healthy (reconnect if needed)
  3. Delete the stale term file for the block so MakeFile can recreate it
  4. Inspect the wrapped fsErr for the concrete filesystem cause

Example fix

// before
fsErr := filestore.WFS.MakeFile(ctx, blockId, wavebase.BlockFile_Term, nil, opts)
// after (caller-side)
_ = filestore.WFS.DeleteFile(ctx, blockId, wavebase.BlockFile_Term) // clear stale file
dsc.Start(ctx, meta, rtOpts, true)
Defensive patterns

Strategy: try-catch

Try / catch

if err := dsc.Start(ctx, meta, rtOpts, true); err != nil && strings.Contains(err.Error(), "error creating block term file") {
    // check disk space / delete stale term file, then retry
}

Prevention

When it happens

Trigger: WFS.MakeFile fails with a real error — disk full, filestore backend (local or remote) unavailable, permission problem, or the block's file area can't be provisioned.

Common situations: Remote connection with a broken filestore; disk quota exceeded on the machine holding the term file; permission issues in the wave data directory; remote filestore call failing over SSH.

Related errors


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