{"record":{"id":"024f5b8c0e041cea","repo":"eyaltoledano/claude-task-master","slug":"no-text-stream-provided","errorCode":null,"errorMessage":"No text stream provided","messagePattern":"No text stream provided","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/utils/stream-parser.js","lineNumber":361,"sourceCode":"\t\tthis.currentSize = newSize;\n\t}\n}\n\n/**\n * Main orchestrator for stream parsing\n */\nclass StreamParserOrchestrator {\n\tconstructor(config) {\n\t\tthis.config = new StreamParserConfig(config);\n\t\tthis.progressTracker = new ProgressTracker(this.config);\n\t\tthis.bufferValidator = new BufferSizeValidator(this.config.maxBufferSize);\n\t\tthis.jsonParser = new JSONStreamParser(this.config, this.progressTracker);\n\t\tthis.fallbackParser = new FallbackParser(this.config, this.progressTracker);\n\t}\n\n\tasync parse(textStream) {\n\t\tif (!textStream) {\n\t\t\tthrow new Error('No text stream provided');\n\t\t}\n\n\t\tawait this.processStream(textStream);\n\t\tawait this.waitForParsingCompletion();\n\n\t\tconst usedFallback = await this.attemptFallbackIfNeeded();\n\n\t\treturn this.buildResult(usedFallback);\n\t}\n\n\tasync processStream(textStream) {\n\t\tconst processor = new StreamProcessor((chunk) => {\n\t\t\tthis.bufferValidator.validateChunk(\n\t\t\t\tthis.progressTracker.accumulatedText,\n\t\t\t\tchunk\n\t\t\t);\n\t\t\tthis.progressTracker.addText(chunk);\n\t\t\tthis.jsonParser.write(chunk);","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/utils/stream-parser.js#L343-L379","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the AI stream is actually fetched and non-empty before calling parse (check the response body/text exists).","Log or inspect the value passed to parse; if it comes from a promise or nested property, verify the upstream call succeeded.","Guard the call site: if (!textStream) skip parsing or re-fetch the stream instead of invoking the parser.","If the stream legitimately may be absent, catch this Error and treat it as a no-op rather than a failure."],"exampleFix":"// before\nconst result = await parser.parse(aiResponse.choices[0].text);\n// after\nconst text = aiResponse?.choices?.[0]?.text;\nif (!text) {\n  throw new Error('AI response contained no text to parse');\n}\nconst result = await parser.parse(text);","handlingStrategy":"validation","validationCode":"function canParse(textStream) {\n  return typeof textStream === 'string'\n    ? textStream.length > 0\n    : textStream != null; // streams/readables pass through\n}\n// call site\nif (!canParse(stream)) {\n  throw new Error('Refusing to parse: no AI text stream available');\n}\nconst result = await parser.parse(stream);","typeGuard":"function hasTextStream(v) {\n  return v != null && (typeof v === 'string' || typeof v[Symbol.asyncIterator] === 'function');\n}","tryCatchPattern":"try {\n  await parser.parse(stream);\n} catch (err) {\n  if (err.message === 'No text stream provided') {\n    // recover: re-fetch stream or skip\n  } else {\n    throw err;\n  }\n}","preventionTips":["Always fetch and inspect the AI response before constructing the parser.","Use optional chaining on upstream response objects and fail early with your own descriptive error.","In tests, assert mocks return a non-empty stream string.","Never pass possibly-undefined variables straight into parse()."],"tags":["validation","streaming","argument-error","fail-fast"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}