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

Crash when writing debug logs #466

Open
mmaitre314 opened this issue Sep 7, 2024 · 0 comments · May be fixed by #470
Open

Crash when writing debug logs #466

mmaitre314 opened this issue Sep 7, 2024 · 0 comments · May be fixed by #470

Comments

@mmaitre314
Copy link

When the tool fails to parse a JSON file, it crashes trying to write a debug log:

> npx tfx-cli extension create --manifests test.json --no-color --trace-level debug
TFS Cross Platform Command Line Interface v0.17.0
Copyright Microsoft Corporation
2024-09-07T19:10:32.263Z : merger.merge
2024-09-07T19:10:32.265Z : merger.gatherManifests
2024-09-07T19:10:32.266Z : Merging 1 manifest from the following paths:
2024-09-07T19:10:32.267Z : test.json
error: Error parsing the JSON in C:\Source\ado-notebook-preview\test.json:
2024-09-07T19:10:32.272Z : Error: The number of replacements (1) does not match the number of placeholders (0)
2024-09-07T19:10:32.272Z :     at format (C:\Source\ado-notebook-preview\node_modules\tfx-cli\_build\lib\trace.js:98:15)
2024-09-07T19:10:32.272Z :     at write (C:\Source\ado-notebook-preview\node_modules\tfx-cli\_build\lib\trace.js:83:24)
2024-09-07T19:10:32.272Z :     at log (C:\Source\ado-notebook-preview\node_modules\tfx-cli\_build\lib\trace.js:68:9)
2024-09-07T19:10:32.272Z :     at Object.debug (C:\Source\ado-notebook-preview\node_modules\tfx-cli\_build\lib\trace.js:60:9)
2024-09-07T19:10:32.272Z :     at C:\Source\ado-notebook-preview\node_modules\tfx-cli\_build\exec\extension\_lib\merger.js:157:43
2024-09-07T19:10:32.272Z :     at async Promise.all (index 0)
error: Error: The number of replacements (1) does not match the number of placeholders (0)

This is likely due to the code calling trace.debug(jsonData, null); in merger.js with the JSON string as first parameter, which gets interpreted as a format string.

test.json file to repro:

{
    // A comment
}
@polatengin polatengin self-assigned this Sep 24, 2024
@polatengin polatengin linked a pull request Sep 24, 2024 that will close this issue
@polatengin polatengin linked a pull request Sep 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants