Skip to content

Fix confusing error when files have same name but different case#13958

Merged
nachocodoner merged 4 commits intometeor:release-3.4from
sanki92:fix-case-sensitive-file-error-clean
Nov 7, 2025
Merged

Fix confusing error when files have same name but different case#13958
nachocodoner merged 4 commits intometeor:release-3.4from
sanki92:fix-case-sensitive-file-error-clean

Conversation

@sanki92
Copy link
Copy Markdown
Contributor

@sanki92 sanki92 commented Oct 5, 2025

Fix confusing error when files have same name but different case

Problem

When two files exist in the same directory with identical names but different case (e.g., fooBar.tests.js and FooBar.tests.js), Meteor would crash with a confusing source-map error instead of providing a clear message about the filename collision.

Original Error:

Error: "version" is a required argument.
    at Object.getArg (/home/user/.meteor/packages/meteor-tool/...source-map/lib/util.js:24:11)
    at ImportScanner.combineFiles (/tools/isobuild/import-scanner.ts:719:7)

Solution

Added case-sensitive filename collision detection in the addFile method of import-scanner.ts. Now when files differ only in case, the build process throws a clear, actionable error message:

Filename collision detected: "fooBar.tests.js" and "FooBar.tests.js" resolve to the same path when case is ignored. Please ensure file names have consistent casing to avoid conflicts.

Changes Made

  • File Modified: tools/isobuild/import-scanner.ts
  • Method: addFile()
  • Change: Added validation to detect when old.absPath !== absPath but they resolve to the same case-insensitive path
  • Error Message: Clear, user-friendly message explaining the case sensitivity issue

Root Cause

The import scanner uses absPath.toLowerCase() to check for duplicate files, making it case-insensitive. However, when two files have the same lowercase path but different actual paths, the system tries to combine them using combineFiles(), which fails because the source maps cannot be properly merged.

Testing

The fix has been tested to ensure:

  • ✅ Clear error message appears for case-sensitive collisions
  • ✅ Normal file processing continues to work unchanged
  • ✅ No breaking changes to existing functionality

Fixes #13785

- Add case-sensitive filename collision detection in import-scanner.ts
- Throw clear error message when files differ only in case
- Fixes meteor#13785
@netlify
Copy link
Copy Markdown

netlify bot commented Oct 5, 2025

Deploy Preview for v3-meteor-api-docs canceled.

Name Link
🔨 Latest commit 25b6e67
🔍 Latest deploy log https://app.netlify.com/projects/v3-meteor-api-docs/deploys/690dfa3bb62d3f000869cb55

@netlify
Copy link
Copy Markdown

netlify bot commented Oct 5, 2025

Deploy Preview for v3-migration-docs canceled.

Name Link
🔨 Latest commit 25b6e67
🔍 Latest deploy log https://app.netlify.com/projects/v3-migration-docs/deploys/690dfa3b838a9e00089bcc25

@nachocodoner
Copy link
Copy Markdown
Member

nachocodoner commented Oct 6, 2025

I'll take some time to test this locally. Not sure if logging an error is the best approach, instead of just resolving it properly. Though it may be seem fine this solution according to your report details.

Marking it for 3.4, so I can review it later for contributions.

Thank you for your contribution 🚀

@nachocodoner nachocodoner added this to the Release 3.4 milestone Oct 6, 2025
@sanki92
Copy link
Copy Markdown
Contributor Author

sanki92 commented Oct 11, 2025

Hey @nachocodoner! Thanks for reviewing this. Since this PR won’t be merged right away, could you please add the hacktoberfest-accepted label so it counts for the event? Appreciate it!

@nachocodoner nachocodoner changed the base branch from devel to release-3.4 November 7, 2025 15:20
@nachocodoner
Copy link
Copy Markdown
Member

This properly shows the expected message on described case.

image

Merging for its inclusion in last Meteor 3.4-beta.13.

@nachocodoner nachocodoner merged commit 02a38fc into meteor:release-3.4 Nov 7, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confusing error message when two files have same but different case

3 participants