{"record":{"id":"e7cf3ddb41c6a130","repo":"yamadashy/repomix","slug":"failed-to-read-file-paths-from-stdin-error-mess","errorCode":null,"errorMessage":"Failed to read file paths from stdin: ${error.message}","messagePattern":"Failed to read file paths from stdin: (.+?)","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/core/file/fileStdin.ts","lineNumber":111,"sourceCode":"      throw new RepomixError('No valid file paths found in stdin input.');\n    }\n\n    // Convert relative paths to absolute paths and deduplicate\n    const filePaths = resolveAndDeduplicatePaths(validLines, cwd);\n\n    logger.trace(`Found ${filePaths.length} file paths from stdin`);\n\n    return {\n      filePaths,\n      emptyDirPaths: [], // Empty directories not supported with stdin input\n    };\n  } catch (error) {\n    if (error instanceof RepomixError) {\n      throw error;\n    }\n\n    if (error instanceof Error) {\n      throw new RepomixError(`Failed to read file paths from stdin: ${error.message}`);\n    }\n\n    throw new RepomixError('An unexpected error occurred while reading from stdin.');\n  }\n};\n","sourceCodeStart":93,"sourceCodeEnd":117,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/core/file/fileStdin.ts#L93-L117","documentation":"Wrapper error from readFilePathsFromStdin: any non-RepomixError Error while reading stdin (stream/readline failures) is rethrown as a RepomixError carrying the original message. RepomixError instances pass through unchanged.","triggerScenarios":"An Error thrown during stdin stream reading — e.g. the piped stream emits 'error', readline interface creation fails, or the stream is closed prematurely — that is not already a RepomixError.","commonSituations":"Pipes broken by the upstream process dying mid-write (EPIPE), custom deps injected into readFilePathsFromStdin that fail, or non-UTF8/binary data causing decoding issues.","solutions":["Check the 'Failed to read file paths from stdin:' suffix for the underlying cause and fix that.","Ensure the upstream pipe command completes successfully and is not killed early.","Re-run with a simple test pipe (`echo src/index.ts | repomix --stdin`) to isolate the issue.","If injecting custom deps, verify createReadlineInterface and the stream behave per Node readline contract."],"exampleFix":"// before: upstream killed early, EPIPE\nsome-long-cmd | head -c 10 | repomix --stdin\n\n// after: let upstream finish\nsome-long-cmd | repomix --stdin","handlingStrategy":"try-catch","validationCode":"// Ensure the pipe source succeeds before reading stdin in repomix\nconst probe = spawnSync(upstreamCmd, { encoding: 'utf8' });\nif (probe.status !== 0) throw new Error(`Upstream command failed: ${probe.stderr}`);","typeGuard":null,"tryCatchPattern":"try {\n  await repomix.pack({ input: { stdin: true } });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Failed to read file paths from stdin:')) {\n    console.error('Stdin stream error:', e.message.replace('Failed to read file paths from stdin: ', ''));\n  } else throw e;\n}","preventionTips":["Don't truncate the pipe early (avoid `| head` upstream of repomix).","Check the upstream process exit status before piping.","Test with a trivial pipe (`echo src/index.ts | repomix --stdin`) to isolate stream issues.","Keep stdin as UTF-8 text; avoid piping binary data."],"tags":["stdin","stream","error-wrapping"],"backgroundTag":"stdin-read-failed","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}