yamadashy/repomix · error · RepomixError
An unexpected error occurred while reading from stdin.
Error message
An unexpected error occurred while reading from stdin.
What it means
Fallback error from readFilePathsFromStdin for thrown values that are not Error instances. Since there is no message to include, a fixed generic message is thrown after logging the raw value.
Source
Thrown at src/core/file/fileStdin.ts:114
// Convert relative paths to absolute paths and deduplicate
const filePaths = resolveAndDeduplicatePaths(validLines, cwd);
logger.trace(`Found ${filePaths.length} file paths from stdin`);
return {
filePaths,
emptyDirPaths: [], // Empty directories not supported with stdin input
};
} catch (error) {
if (error instanceof RepomixError) {
throw error;
}
if (error instanceof Error) {
throw new RepomixError(`Failed to read file paths from stdin: ${error.message}`);
}
throw new RepomixError('An unexpected error occurred while reading from stdin.');
}
};
View on GitHub (pinned to f465ad9093)
Solutions
- Inspect the logged 'An unexpected error occurred:' output to identify the thrown value.
- Replace or fix custom deps so they throw Error instances only.
- Test in a plain Node environment to rule out runtime/polyfill issues.
- Report the issue upstream with the logged value if it originates in a dependency.
Example fix
// before
reject('stream broke')
// after
reject(new Error('stream broke')) Defensive patterns
Strategy: try-catch
Try / catch
try {
await repomix.pack({ input: { stdin: true } });
} catch (e) {
if (e instanceof Error && e.message === 'An unexpected error occurred while reading from stdin.') {
console.error('A non-Error value was thrown while reading stdin; check custom deps and runtimes.');
} else throw e;
} Prevention
- Only inject deps that honor Node's Error/stream contracts.
- Test stdin handling in plain Node before exotic bundlers/runtimes.
- Enable trace logging to capture the raw thrown value.
- Keep stream/readline-related dependencies current.
When it happens
Trigger: A non-Error value (string, plain object) thrown from within the stdin reading path — typically from a misbehaving custom dep or a faulty stream polyfill.
Common situations: Custom deps injected into readFilePathsFromStdin that violate the throw-Errors contract, or exotic environments (bundlers/minifiers, non-Node runtimes) whose stream shims throw strings.
Related errors
- Failed to read file paths from stdin: ${error.message}
- When using --stdin, do not specify directory arguments. File
- An unexpected error occurred while filtering files.
- No data provided via stdin. Please pipe file paths to repomi
- No valid file paths found in stdin input.
AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29).
Data as JSON: /api/errors/18d140b31b42828b.
Report an issue: GitHub.