{"record":{"id":"9854222d1ed004e5","repo":"yamadashy/repomix","slug":"unsupported-file-format-fileextension-support","errorCode":null,"errorMessage":"Unsupported file format: ${fileExtension}. Supported formats: ${supportedExtensions.join(', ')}","messagePattern":"Unsupported file format: (.+?)\\. Supported formats: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/mcp/tools/attachPackedOutputTool.ts","lineNumber":81,"sourceCode":"          await fs.access(outputFilePath);\n          const format = getFormatFromFileName(fileName);\n          return { filePath: outputFilePath, format };\n        } catch {\n          // File doesn't exist, continue to next\n        }\n      }\n\n      throw new Error(\n        `No repomix output file found in directory: ${inputPath}. Looking for: ${possibleFiles.join(', ')}`,\n      );\n    }\n\n    // If it's a file, check if it's a supported format\n    const supportedExtensions = Object.values(defaultFilePathMap).map((file) => path.extname(file));\n    const fileExtension = path.extname(inputPath).toLowerCase();\n\n    if (!supportedExtensions.includes(fileExtension)) {\n      throw new Error(\n        `Unsupported file format: ${fileExtension}. Supported formats: ${supportedExtensions.join(', ')}`,\n      );\n    }\n\n    const format = getFormatFromExtension(fileExtension);\n    return { filePath: inputPath, format };\n  } catch (error) {\n    if (error instanceof Error && error.message.includes('ENOENT')) {\n      throw new Error(`File or directory not found for path: ${inputPath}`, { cause: error });\n    }\n    throw error;\n  }\n}\n\n/**\n * Get format from file name\n */\nfunction getFormatFromFileName(fileName: string): string {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/mcp/tools/attachPackedOutputTool.ts#L63-L99","documentation":"resolveOutputFilePath validates that a file input has an extension matching one of repomix's supported output formats (derived from the default output file paths: xml, md, json, txt). If the extension is not recognized, it throws because it cannot infer the packed-output format from the file.","triggerScenarios":"Calling the attach tool with a file whose extension is not .xml/.md/.json/.txt (e.g. .yaml, .log, .out, or a file with no extension), or an unusual case variant handled by path.extname but not in the map.","commonSituations":"Renaming repomix-output.xml to something like repomix-output.bak or packing to a custom filename with a non-standard extension; on some systems a file saved without extension after an editor session.","solutions":["Rename the file to use a supported extension (.xml, .md, .json, .txt)","Regenerate the output with the format you want: `repomix --style xml` producing repomix-output.xml","Pass a supported-format file path directly to the tool"],"exampleFix":"// before\nawait attachPackedOutput({ path: './out/repomix-output.yaml' });\n// after\nawait $`mv out/repomix-output.yaml out/repomix-output.xml`; // ensure real xml content\nawait attachPackedOutput({ path: './out/repomix-output.xml' });","handlingStrategy":"validation","validationCode":"const ok = /\\.(xml|md|json|txt)$/i.test(inputPath);\nif (!ok) throw new Error(`Rename ${inputPath} to a .xml/.md/.json/.txt repomix output`);","typeGuard":null,"tryCatchPattern":"try {\n  await attachPackedOutput({ path: inputPath });\n} catch (e) {\n  if (String(e.message).startsWith('Unsupported file format')) {\n    // rename/copy to a supported extension and retry\n  } else throw e;\n}","preventionTips":["Keep repomix outputs at their default filenames","Never rename outputs to non-standard extensions","Store format in the filename extension when scripting"],"tags":["mcp","validation","unsupported-format"],"backgroundTag":"unsupported-file-format","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}