eyaltoledano/claude-task-master · error · Error

Multibar instance is required

Error message

Multibar instance is required

What it means

ProgressBarFactory's constructor requires a live multibar instance (from cli-progress MultiBar) and throws if it is falsy. The factory delegates all bar creation to this instance, so it cannot function without it.

Source

Thrown at src/progress/tracker-ui.js:9

import chalk from 'chalk';

/**
 * Factory for creating progress bar elements
 */
class ProgressBarFactory {
	constructor(multibar) {
		if (!multibar) {
			throw new Error('Multibar instance is required');
		}
		this.multibar = multibar;
	}

	/**
	 * Creates a progress bar with the given format
	 */
	createBar(format, payload = {}) {
		if (typeof format !== 'string') {
			throw new Error('Format must be a string');
		}

		const bar = this.multibar.create(
			1, // total
			1, // current
			{},
			{
				format,

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Create the multibar first: const multibar = new cliProgress.MultiBar({...}); then pass it to ProgressBarFactory.
  2. Check the variable passed in for typos/undefined at the construction site.
  3. Ensure the factory is instantiated after progress system initialization, not at module load time.
  4. Verify the multibar hasn't been stopped/destroyed earlier in teardown code.

Example fix

// before
// const factory = new ProgressBarFactory(multibar); // multibar undefined
// after
// const multibar = new cliProgress.MultiBar({ clearOnComplete: true });
// const factory = new ProgressBarFactory(multibar);
Defensive patterns

Strategy: validation

Validate before calling

function createProgressFactory(multibar) {
  if (!multibar || typeof multibar.create !== 'function') {
    throw new Error('Provide an initialized cli-progress MultiBar before creating ProgressBarFactory');
  }
  return new ProgressBarFactory(multibar);
}

Type guard

function isMultiBar(m) {
  return m != null && typeof m === 'object' && typeof m.create === 'function';
}

Try / catch

try {
  const factory = new ProgressBarFactory(multibar);
} catch (e) {
  if (e.message === 'Multibar instance is required') {
    multibar = new cliProgress.MultiBar({}, cliProgress.Presets.shades_classic);
    return new ProgressBarFactory(multibar);
  }
  throw e;
}

Prevention

When it happens

Trigger: new ProgressBarFactory() or new ProgressBarFactory(null/undefined) — usually because the multibar was not yet created or was already closed/destroyed before the factory was constructed.

Common situations: Creating the factory before initializing cli-progress MultiBar, storing the multibar in a lazily-initialized singleton that is still undefined, passing the wrong variable (undefined due to a typo or failed import).

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/4dd478c78ec514ca. Report an issue: GitHub.