eyaltoledano/claude-task-master · error

No text stream provided

Error message

No text stream provided

What it means

The StreamParser's public parse() method requires a text stream (string or stream of AI output) to process. It throws a plain Error immediately if the argument is falsy (null, undefined, or empty), before any parsing begins. This is a fail-fast guard: the parser cannot produce structured JSON output without input text, so it aborts rather than silently returning empty results.

Source

Thrown at src/utils/stream-parser.js:361

		this.currentSize = newSize;
	}
}

/**
 * Main orchestrator for stream parsing
 */
class StreamParserOrchestrator {
	constructor(config) {
		this.config = new StreamParserConfig(config);
		this.progressTracker = new ProgressTracker(this.config);
		this.bufferValidator = new BufferSizeValidator(this.config.maxBufferSize);
		this.jsonParser = new JSONStreamParser(this.config, this.progressTracker);
		this.fallbackParser = new FallbackParser(this.config, this.progressTracker);
	}

	async parse(textStream) {
		if (!textStream) {
			throw new Error('No text stream provided');
		}

		await this.processStream(textStream);
		await this.waitForParsingCompletion();

		const usedFallback = await this.attemptFallbackIfNeeded();

		return this.buildResult(usedFallback);
	}

	async processStream(textStream) {
		const processor = new StreamProcessor((chunk) => {
			this.bufferValidator.validateChunk(
				this.progressTracker.accumulatedText,
				chunk
			);
			this.progressTracker.addText(chunk);
			this.jsonParser.write(chunk);

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Ensure the AI stream is actually fetched and non-empty before calling parse (check the response body/text exists).
  2. Log or inspect the value passed to parse; if it comes from a promise or nested property, verify the upstream call succeeded.
  3. Guard the call site: if (!textStream) skip parsing or re-fetch the stream instead of invoking the parser.
  4. If the stream legitimately may be absent, catch this Error and treat it as a no-op rather than a failure.

Example fix

// before
const result = await parser.parse(aiResponse.choices[0].text);
// after
const text = aiResponse?.choices?.[0]?.text;
if (!text) {
  throw new Error('AI response contained no text to parse');
}
const result = await parser.parse(text);
Defensive patterns

Strategy: validation

Validate before calling

function canParse(textStream) {
  return typeof textStream === 'string'
    ? textStream.length > 0
    : textStream != null; // streams/readables pass through
}
// call site
if (!canParse(stream)) {
  throw new Error('Refusing to parse: no AI text stream available');
}
const result = await parser.parse(stream);

Type guard

function hasTextStream(v) {
  return v != null && (typeof v === 'string' || typeof v[Symbol.asyncIterator] === 'function');
}

Try / catch

try {
  await parser.parse(stream);
} catch (err) {
  if (err.message === 'No text stream provided') {
    // recover: re-fetch stream or skip
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Calling streamParser.parse(null), parse(undefined), parse(''), or parse(await somePromiseThatResolvedToUndefined); passing a variable that was never assigned because the upstream AI stream failed to initialize; destructuring a config object and forwarding a missing stream property.

Common situations: Developers wiring the parser to an LLM client whose response object shape changed (e.g. accessing response.text on a failed response), calling parse before the stream is opened, or conditionally skipping stream fetch logic so the variable stays undefined in tests or mocked environments.

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/024f5b8c0e041cea. Report an issue: GitHub.