Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExpectedError: failed to replace output token: {batocera} #1367

Open
yodatak opened this issue Sep 29, 2024 · 4 comments
Open

ExpectedError: failed to replace output token: {batocera} #1367

yodatak opened this issue Sep 29, 2024 · 4 comments
Labels
potential-bug A potential issue that needs confirmation and/or triage

Comments

@yodatak
Copy link

yodatak commented Sep 29, 2024

Paste the command

npx --yes igir@latest copy zip test clean
--dat "/mnt/Emulation/batocera/dat/*.zip"
--input "/mnt/Emulation/batocera/new"
--input "/mnt/Emulation/batocera2/{batocera}"
--output "/mnt/Emulation/batocera2/{batocera}"
--dir-letter
--no-bios

Describe the bug

✓ Scanning for ROMs ··············· | 204 957 files found
✓ Amstrad - CPC (Misc) ············ | 1/1 games, 1/1 retail releases written
✓ Atari - 2600 ···················· | 495/808 games, 436/680 retail releases written
✓ Atari - 7800 (BIN) ·············· | 58/124 games, 58/108 retail releases written
✓ Atari - 5200 ···················· | 94/119 games, 71/84 retail releases written
✓ Atari - 8-bit Family ············ | 1/24 games, 1/24 retail releases written
✓ Atari - Jaguar (J64) ············ | 42/91 games, 41/51 retail releases written
✓ Atari - Lynx (LYX) ·············· | 82/126 games, 74/86 retail releases written
✓ Bandai - WonderSwan ············· | 24/255 games, 24/198 retail releases written
✓ Coleco - ColecoVision ··········· | 16/200 games, 16/156 retail releases written
Processing DATs ··················· | ████▒░░░░░░░░░░░░░░░ | 80/357 | ETA: 1m

Atari - ST ······················ | ████████████▒░░░░░░░ | 238/393 | ETA: 1s

Bandai - WonderSwan Color ······· | ░░░░░░░░░░░░░░░░░░░░ | 0/86

Σ Commodore - Amiga ··············· | ███████████████████▒ | 2 836/2 842
file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/types/outputFactory.js:121
throw new ExpectedError(failed to replace output token${leftoverTokens.length !== 1 ? 's' : ''}: ${leftoverTokens.join(', ')});
^

ExpectedError: failed to replace output token: {batocera}
at OutputFactory.replaceTokensInOutputPath (file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/types/outputFactory.js:121:19)
at OutputFactory.getDir (file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/types/outputFactory.js:86:49)
at OutputFactory.getPath (file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/types/outputFactory.js:69:23)
at file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/modules/candidates/candidateGenerator.js:326:31
at Array.every ()
at CandidateGenerator.shouldGenerateArchiveFile (file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/modules/candidates/candidateGenerator.js:323:45)
at CandidateGenerator. (file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/modules/candidates/candidateGenerator.js:144:26)
at Generator.next ()
at file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/modules/candidates/candidateGenerator.js:7:71
at new Promise ()
at __awaiter (file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/modules/candidates/candidateGenerator.js:3:12)
at file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/modules/candidates/candidateGenerator.js:97:71
at Array.map ()
at CandidateGenerator. (file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/modules/candidates/candidateGenerator.js:97:58)
at Generator.next ()
at file:///root/.npm/_npx/0d8028b15d717946/node_modules/igir/dist/src/modules/candidates/candidateGenerator.js:7:71

Expected behavior

Say why it crash and how to fix it

Debug logs

[19:15:52.432] TRACE: CandidateWriter: Coleco - ColecoVision: Zaxxon (USA, Europe): no raw files to write
[19:15:52.436] TRACE: CandidateWriter: Coleco - ColecoVision: Zaxxon (USA, Europe) (parent): done writing 1 candidate
[19:15:52.436] TRACE: CandidateWriter: Coleco - ColecoVision: done writing 16 candidates
[19:15:52.436] TRACE: StatusGenerator: Coleco - ColecoVision: generating ROM statuses
[19:15:52.437] TRACE: StatusGenerator: Coleco - ColecoVision: done generating ROM statuses
Coleco - ColecoVision ... 16/200 games, 16/156 retail releases written
[19:15:52.444] TRACE: DATParentInferrer: Commodore - Amiga: inferring parents for 3 176 games
[19:15:52.616] TRACE: DATParentInferrer: Commodore - Amiga: grouped to 2 853 parents
[19:15:52.616] TRACE: DATParentInferrer: done inferring parents
[19:15:52.616] TRACE: DATMergerSplitter: Commodore - Amiga: merging & splitting 3 176 games
[19:15:52.630] TRACE: DATMergerSplitter: Commodore - Amiga: merged/split to 3 176 games
[19:15:52.630] TRACE: DATMergerSplitter: Commodore - Amiga: done merging & splitting
[19:15:52.630] TRACE: DATFilter: Commodore - Amiga: filtering DAT
[19:15:52.634] TRACE: DATFilter: Commodore - Amiga: filtered to 3 152/3 176 games (5.5GB)
[19:15:52.634] TRACE: DATFilter: Commodore - Amiga: done filtering DAT
[19:15:52.634] TRACE: CandidateGenerator: Commodore - Amiga: generating candidates

root@anarchy ~#

DAT(s) used

No response

igir version

v3.0.1

Node.js version

v20.17.0

Operating system

fedora server 40

Additional context

dat used
-rwxr--r-- 1 yodatak yodatak 16K 26 sept. 17:17 'Acorn - Archimedes - Datfile (72) (2024-06-29 12-04-01).zip'*
-rwxr--r-- 1 yodatak yodatak 251K 26 sept. 17:17 'Apple - Macintosh - Datfile (1171) (2024-09-13 16-15-43).zip'*
-rwxr--r-- 1 yodatak yodatak 5,2K 26 sept. 17:18 'Arcade - Namco - Sega - Nintendo - Triforce - Datfile (22) (2024-03-27 18-54-01).zip'*
-rwxr--r-- 1 yodatak yodatak 1,5K 26 sept. 17:18 'Arcade - Namco - System 246 - Datfile (9) (2024-03-16 19-39-56).zip'*
-rwxr--r-- 1 yodatak yodatak 4,4K 26 sept. 17:18 'Arcade - Sega - Chihiro - Datfile (18) (2021-01-08 16-58-30).zip'*
-rwxr--r-- 1 yodatak yodatak 2,7K 26 sept. 17:18 'Arcade - Sega - Naomi 2 - Datfile (9) (2024-04-12 21-19-25).zip'*
-rwxr--r-- 1 yodatak yodatak 7,1K 26 sept. 17:18 'Arcade - Sega - Naomi - Datfile (30) (2024-03-27 16-44-11).zip'*
-rwxr--r-- 1 yodatak yodatak 21K 26 sept. 17:17 'Atari - Jaguar CD Interactive Multimedia System - Datfile (25) (2024-06-14 12-29-45).zip'*
-rwxr--r-- 1 yodatak yodatak 4,2K 26 sept. 17:17 'Bandai - Pippin - Datfile (24) (2024-08-15 18-11-38).zip'*
-rwxr--r-- 1 yodatak yodatak 8,8K 26 sept. 17:17 'Bandai - Playdia Quick Interactive System - Datfile (38) (2022-07-06 01-08-10).zip'*
-rwxr--r-- 1 yodatak yodatak 112K 26 sept. 17:17 'Commodore - Amiga CD32 - Datfile (200) (2024-09-02 11-47-45).zip'*
-rwxr--r-- 1 yodatak yodatak 104K 26 sept. 17:17 'Commodore - Amiga CD - Datfile (583) (2024-09-25 20-28-44).zip'*
-rwxr--r-- 1 yodatak yodatak 21K 26 sept. 17:17 'Commodore - Amiga CDTV - Datfile (58) (2024-06-16 21-47-17).zip'*
-rwxr--r-- 1 yodatak yodatak 12M 26 sept. 17:17 'IBM - PC compatible - Datfile (49297) (2024-09-26 16-29-18).zip'*
-rwxr--r-- 1 yodatak yodatak 281K 26 sept. 17:17 'Microsoft - Xbox 360 - Datfile (3434) (2024-09-25 03-55-01).zip'*
-rwxr--r-- 1 yodatak yodatak 211K 26 sept. 17:17 'Microsoft - Xbox - Datfile (2623) (2024-09-25 04-35-56).zip'*
-rwxr--r-- 1 yodatak yodatak 3,5K 26 sept. 17:18 'NEC - PC-88 series - Datfile (2) (2023-10-27 09-53-41).zip'*
-rwxr--r-- 1 yodatak yodatak 81K 26 sept. 17:18 'NEC - PC-98 series - Datfile (118) (2024-09-02 12-44-17).zip'*
-rwxr--r-- 1 yodatak yodatak 985K 26 sept. 17:18 'NEC - PC Engine CD & TurboGrafx CD - Datfile (547) (2024-09-23 14-50-41).zip'*
-rwxr--r-- 1 yodatak yodatak 59K 26 sept. 17:18 'NEC - PC-FX & PC-FXGA - Datfile (79) (2024-08-01 15-16-53).zip'*
-rwxr--r-- 1 yodatak yodatak 162K 26 sept. 17:18 'Nintendo - GameCube - Datfile (2000) (2024-09-25 04-36-05).zip'*
-rwxr--r-- 1 yodatak yodatak 312K 26 sept. 17:18 'Nintendo - Wii - Datfile (3773) (2024-09-25 03-41-00).zip'*
-rwxr--r-- 1 yodatak yodatak 94M 26 sept. 17:16 'No-Intro Love Pack (Standard) (2024-09-26).zip'*
-rwxr--r-- 1 yodatak yodatak 97K 26 sept. 17:18 'Panasonic - 3DO Interactive Multiplayer - Datfile (655) (2024-09-24 02-52-22).zip'*
-rwxr--r-- 1 yodatak yodatak 407K 26 sept. 17:18 'Philips - CD-i - Datfile (2226) (2024-09-18 18-18-36).zip'*
-rwxr--r-- 1 yodatak yodatak 726K 26 sept. 17:18 'Sega - Dreamcast - Datfile (1488) (2024-09-13 14-42-29).zip'*
-rwxr--r-- 1 yodatak yodatak 524K 26 sept. 17:18 'Sega - Mega CD & Sega CD - Datfile (542) (2024-09-08 00-37-39).zip'*
-rwxr--r-- 1 yodatak yodatak 1,8M 26 sept. 17:18 'Sega - Saturn - Datfile (2373) (2024-09-22 20-13-54).zip'*
-rwxr--r-- 1 yodatak yodatak 203K 26 sept. 17:18 'SNK - Neo Geo CD - Datfile (111) (2024-08-27 17-30-12).zip'*
-rwxr--r-- 1 yodatak yodatak 1,3M 26 sept. 17:18 'Sony - PlayStation 2 - Datfile (11529) (2024-09-26 10-03-11).zip'*
-rwxr--r-- 1 yodatak yodatak 395K 26 sept. 17:18 'Sony - PlayStation 3 - Datfile (4393) (2024-09-26 08-55-01).zip'*
-rwxr--r-- 1 yodatak yodatak 3,9M 26 sept. 17:18 'Sony - PlayStation - Datfile (10789) (2024-09-25 04-42-07).zip'*
-rwxr--r-- 1 yodatak yodatak 262K 26 sept. 17:18 'Sony - PlayStation Portable - Datfile (2924) (2024-09-25 22-47-33).zip'*
-rwxr--r-- 1 yodatak yodatak 8,3K 26 sept. 17:18 'VTech - V.Flash & V.Smile Pro - Datfile (50) (2024-03-01 15-44-21).zip'*

@yodatak yodatak added the potential-bug A potential issue that needs confirmation and/or triage label Sep 29, 2024
@yodatak
Copy link
Author

yodatak commented Sep 29, 2024

maybe its linked to

new GameConsole(/Amiga/i, [], {

@iredmedia
Copy link

iredmedia commented Oct 16, 2024

I'm having the same issue, seems to be WonderSwan / Color

Tried adding --dat-name-regex-exclude "/encrypted|source code|bandai/i" and --dat-name-regex-exclude "/encrypted|source code|wonderswan/i" but it doesn't seem to be excluding the dats.

@yodatak
Copy link
Author

yodatak commented Oct 17, 2024

Thanks @iredmedia for me, it don't fix anything I think it makes error on some other game systems :/ it's definite an issue

@iredmedia
Copy link

iredmedia commented Oct 19, 2024

TLDR

A simple-ish solution would be to run 1 command per folder. Just go inside the folder of your roms (assuming you a have 1 folder per system setup), replace your variables / options below and you're off to the races. The important bit is: --input {} which just gets the output from the find command.

find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "igir copy zip test --dat PUT_YOUR_DAT_FOLDER_HERE --input {} --output PUT_OUTPUT_HERE/{es} --no-bios --single --prefer-language EN --prefer-region USA,WORLD,EUR,JPN" \;

Root cause/Fix

Found the offending code, you were right, I found a few systems failing, Bandai wasn't one of them. GamePark was one of
them.

It seems there's a try-catch when calling the output factory, but if that fails, it's a full stop on the execution instead of gracefully continuing.

Wrapping the statements in candidateGenerator.ts in the try catch below it seems to resolve the issue, but I haven't dug or created tests.

        try {
          /**
           * If the matched input file is from an archive, and we can raw-copy that entire archive,
           * then treat the file as "raw" so it can be copied/moved as-is.
           */
          if (
            inputFile instanceof ArchiveEntry &&
            this.shouldGenerateArchiveFile(dat, game, release, rom, romsToInputFiles)
          ) {
            try {
              // Note: we're delaying checksum calculations for now,
              // {@link CandidateArchiveFileHasher} will handle it later
              inputFile = new ArchiveFile(inputFile.getArchive(), {
                size: await fsPoly.size(inputFile.getFilePath()),
                checksumBitmask: inputFile.getChecksumBitmask(),
              });
            } catch (error) {
              this.progressBar.logWarn(`${dat.getNameShort()}: ${game.getName()}: ${error}`);
              return [rom, undefined];
            }
          }

Basically these lines are saying gameConsole.ts gave me nothing back, so result had leftover tokens, meaning it cannot respect your chosen output path. Failure is reasonable but a skip and report would be nice.

If maintainer sees this, they may have more insights, but at least root causes seem to be identified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential-bug A potential issue that needs confirmation and/or triage
Projects
None yet
Development

No branches or pull requests

2 participants