Crash when writing debug logs
Assessment
This issue has not been assessed yet.
Description
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
}
- Dominant language
- TypeScript
- Stars
- 386
- Forks
- 142
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/tfs-cli
-
Area: tfx-cli DevOps enhancement
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Area: tfx-cli triage
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Area: tfx-cli triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Area: tfx-cli triage
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Area: tfx-cli triage
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in microsoft/tfs-cli
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
EclipseFdn/open-vsx.org#13385 · 1 comment ·
-
S: triage
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
fix(errors): EHOSTUNREACH from a happy-eyeballs connect is reported as a resolver error (STAMP-80) Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
snapshot-labs/stamp#666 ·
-
vangogh
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
knaw-huc/textannoviz#691 ·