yamadashy/repomix · error · RepomixError

Failed to read file paths from stdin: ${error.message}

Error message

Failed to read file paths from stdin: ${error.message}

What it means

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.

Source

Thrown at src/core/file/fileStdin.ts:111

      throw new RepomixError('No valid file paths found in stdin input.');
    }

    // 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. Check the 'Failed to read file paths from stdin:' suffix for the underlying cause and fix that.
  2. Ensure the upstream pipe command completes successfully and is not killed early.
  3. Re-run with a simple test pipe (`echo src/index.ts | repomix --stdin`) to isolate the issue.
  4. If injecting custom deps, verify createReadlineInterface and the stream behave per Node readline contract.

Example fix

// before: upstream killed early, EPIPE
some-long-cmd | head -c 10 | repomix --stdin

// after: let upstream finish
some-long-cmd | repomix --stdin
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure the pipe source succeeds before reading stdin in repomix
const probe = spawnSync(upstreamCmd, { encoding: 'utf8' });
if (probe.status !== 0) throw new Error(`Upstream command failed: ${probe.stderr}`);

Try / catch

try {
  await repomix.pack({ input: { stdin: true } });
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Failed to read file paths from stdin:')) {
    console.error('Stdin stream error:', e.message.replace('Failed to read file paths from stdin: ', ''));
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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