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

  1. Inspect the logged 'An unexpected error occurred:' output to identify the thrown value.
  2. Replace or fix custom deps so they throw Error instances only.
  3. Test in a plain Node environment to rule out runtime/polyfill issues.
  4. 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

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


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/18d140b31b42828b. Report an issue: GitHub.