{"record":{"id":"18d140b31b42828b","repo":"yamadashy/repomix","slug":"an-unexpected-error-occurred-while-reading-from-st","errorCode":null,"errorMessage":"An unexpected error occurred while reading from stdin.","messagePattern":"An unexpected error occurred while reading from stdin\\.","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/core/file/fileStdin.ts","lineNumber":114,"sourceCode":"    // 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":96,"sourceCodeEnd":117,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/core/file/fileStdin.ts#L96-L117","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom deps injected into readFilePathsFromStdin that violate the throw-Errors contract, or exotic environments (bundlers/minifiers, non-Node runtimes) whose stream shims throw strings.","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."],"exampleFix":"// before\nreject('stream broke')\n\n// after\nreject(new Error('stream broke'))","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await repomix.pack({ input: { stdin: true } });\n} catch (e) {\n  if (e instanceof Error && e.message === 'An unexpected error occurred while reading from stdin.') {\n    console.error('A non-Error value was thrown while reading stdin; check custom deps and runtimes.');\n  } else throw e;\n}","preventionTips":["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."],"tags":["stdin","stream","unexpected-error"],"backgroundTag":"unexpected-throw-non-error","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}