eyaltoledano/claude-task-master · error · Error

Spinner messages must be an array

Error message

Spinner messages must be an array

What it means

ProgressTrackerBuilder.withSpinner() requires its argument to be an array of spinner frames/messages; passing null, undefined, or a non-array (e.g. a single string) throws immediately. This is a fluent-builder guard to fail fast on malformed configuration.

Source

Thrown at src/progress/progress-tracker-builder.js:55

	withPercent() {
		this.config.addFeature('percent');
		return this;
	}

	withTokens() {
		this.config.addFeature('tokens');
		return this;
	}

	withTasks() {
		this.config.addFeature('tasks');
		return this;
	}

	withSpinner(messages) {
		if (!messages || !Array.isArray(messages)) {
			throw new Error('Spinner messages must be an array');
		}
		this.config.spinnerFrames = messages;
		return this;
	}

	withUnits(total, unitName = 'unit') {
		this.config.totalUnits = total;
		this.config.unitName = unitName;
		return this;
	}

	build() {
		return new ProgressTracker(this.config);
	}
}

/**
 * Base progress tracker with configurable features

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Wrap the message in an array: withSpinner(['Loading...']).
  2. Default to an empty/guarded value when config may be absent: withSpinner(config.frames ?? []).
  3. Convert a single string to an array at the call site before invoking.
  4. Check the builder API docs — frames, not a single message, are expected.

Example fix

// before
// trackerBuilder.withSpinner('Working')
// after
// trackerBuilder.withSpinner(['Working', 'Still working...', 'Almost done'])
Defensive patterns

Strategy: validation

Validate before calling

function safeWithSpinner(builder, messages) {
  const frames = typeof messages === 'string' ? [messages] : Array.isArray(messages) ? messages : [];
  return frames.length ? builder.withSpinner(frames) : builder;
}

Type guard

function isSpinnerFrames(v) {
  return Array.isArray(v) && v.every((x) => typeof x === 'string');
}

Try / catch

try {
  builder.withSpinner(config.spinnerMessages);
} catch (e) {
  if (e.message === 'Spinner messages must be an array') {
    builder.withSpinner(['Working...']); // sensible default
  } else throw e;
}

Prevention

When it happens

Trigger: builder.withSpinner('Loading...') (a string instead of an array) or withSpinner(null) / withSpinner(undefined).

Common situations: Assuming withSpinner accepts a single message string, passing a config value that is optionally undefined, wiring spinner text from a config file that supplies a string.

Understand the failure class

Background: Invalid argument type errors: "must be of type string", "expected X, got Y", and ERR_INVALID_ARG_TYPE explained — this error's family across 15 libraries.

Related errors


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