You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Extension startup crash - error: "Cannot convert undefined or null to object" #14
2025-11-29 11:52:00.012 [error] Activating extension ycodetech.automatic-comment-blocks failed due to an error:
2025-11-29 11:52:00.012 [error] TypeError: Cannot convert undefined or null to object
at Object.keys (<anonymous>)
at /home/c512l/.vscode-oss/extensions/ycodetech.automatic-comment-blocks-1.1.11-universal/out/src/configuration.js:332:28
at Array.forEach (<anonymous>)
at /home/c512l/.vscode-oss/extensions/ycodetech.automatic-comment-blocks-1.1.11-universal/out/src/configuration.js:329:19
at Map.forEach (<anonymous>)
at Configuration.setLanguageConfigDefinitions (/home/c512l/.vscode-oss/extensions/ycodetech.automatic-comment-blocks-1.1.11-universal/out/src/configuration.js:327:38)
at new Configuration (/home/c512l/.vscode-oss/extensions/ycodetech.automatic-comment-blocks-1.1.11-universal/out/src/configuration.js:72:14)
at Object.<anonymous> (/home/c512l/.vscode-oss/extensions/ycodetech.automatic-comment-blocks-1.1.11-universal/out/src/extension.js:12:21)
at Module._compile (node:internal/modules/cjs/loader:1714:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1848:10)
at Module.load (node:internal/modules/cjs/loader:1448:32)
at Module._load (node:internal/modules/cjs/loader:1270:12)
at c._load (node:electron/js2c/node_init:2:17993)
at e._load (file:///usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:402:6573)
at t._load (file:///usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:220:28755)
at r._load (file:///usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:212:24901)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:244:24)
at Module.require (node:internal/modules/cjs/loader:1470:12)
at require (node:internal/modules/helpers:147:16)
at xX._doLoadModule (file:///usr/share/codium/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:251:1632)
changed the title [-][BUG]: Extension startup crash[/-][+][BUG]: Extension startup crash - error: "Cannot convert undefined or null to object"[/+]on Dec 3, 2025
@C-512L This crash happens because it can't parse a JSON file for whatever reason, which returns undefined or null to it's calling function and then the subsequent code causes the Cannot convert undefined or null to object error. I will add error handling and log errors to the Output Channel, and show a user dialog to check the output.
However, I think it'll be best to let the extension crash on startup when these errors occur since parsing JSON files is vital for it's functionality.
@C-512L I've released v1.1.12. It now logs JSON parse errors to our dedicated Output Channel, and throws the error at the point of parsing so the extension will still crash, however it will be easier to see what's going on.
Once you've updated to the new version, and the extension still crashes, please can you reopen the issue and provide the full errors from the Auto Comment Blocks Output Channel.
Also found parsing syler.sass-indented fails with:
[error] Error: ENOENT: no such file or directory, open '/home/c512l/.vscode-oss/extensions/syler.sass-indented-1.8.33-universal/sass.configuration.json'
@C-512L Mermaid Language:
Apparently the JSON file was saved as UTF-8 with BOM encoding, the BOM part of the file fails the parsing with an Invalid Symbol error. I've fixed this by removing the BOM character codes from the file output before parsing.
Any empty JSON files:
I can see the parsing fails for empty files with Value Expected error. The parse method does have an option to allowEmptyContent, so I have added this option to prevent it from erroring out, and then the extension will just return an empty object {} as already implemented. (Note: empty objects will render the language as unsupported.)
syler.sass-indented:
This error indicates that the path is wrong and it doesn't exist. Please can you confirm if this exact path exists or not.
@C-512L Hmm. I'm confused then, because it should be in the same directory as it's package.json which is where it read the sass.configuration.json from.
It'll help me debug if you could send me the entirety of the dedicated Auto Comment Blocks Output channel. Please save the entire log to file using the Save Output As button in the Output's "3-dot menu", and attach the file here. If you're worried about sensitive env variables that are logged for debugging, then you can email the log file if you wish (stuart-norman@hotmail.com)
@C-512L Ok. I'm glad we found the cause of that issue. I've posted a temporary workaround on the issue. It should work universally with vscodium and others.
Activity
[-][BUG]: Extension startup crash[/-][+][BUG]: Extension startup crash - error: "Cannot convert undefined or null to object"[/+]yCodeTech commentedon Dec 5, 2025
@C-512L This crash happens because it can't parse a JSON file for whatever reason, which returns
undefined or nullto it's calling function and then the subsequent code causes theCannot convert undefined or null to objecterror. I will add error handling and log errors to the Output Channel, and show a user dialog to check the output.However, I think it'll be best to let the extension crash on startup when these errors occur since parsing JSON files is vital for it's functionality.
fix: #14 by adding `null` checks and error handling for JSON parsing
Fix `readJsonFile` and add error handling (#15)
yCodeTech commentedon Dec 5, 2025
@C-512L I've released v1.1.12. It now logs JSON parse errors to our dedicated Output Channel, and throws the error at the point of parsing so the extension will still crash, however it will be easier to see what's going on.
Once you've updated to the new version, and the extension still crashes, please can you reopen the issue and provide the full errors from the
Auto Comment BlocksOutput Channel.C-512L commentedon Dec 5, 2025
I have found a few example of files failing to parse:
https://github.com/bpruitt-goddard/vscode-mermaid-syntax-highlight/blob/master/mermaid-language-configuration.json
https://github.com/hyperupcall-projects/vscode-assorted-languages/blob/main/language-configuration/digrc.language-configuration.json (emtpy file, writting
{}fixes it)C-512L commentedon Dec 5, 2025
Also found parsing
syler.sass-indentedfails with:yCodeTech commentedon Dec 7, 2025
@C-512L
Mermaid Language:
Apparently the JSON file was saved as UTF-8 with BOM encoding, the BOM part of the file fails the parsing with an
Invalid Symbolerror. I've fixed this by removing the BOM character codes from the file output before parsing.Any empty JSON files:
I can see the parsing fails for empty files with
Value Expectederror. Theparsemethod does have an option toallowEmptyContent, so I have added this option to prevent it from erroring out, and then the extension will just return an empty object{}as already implemented. (Note: empty objects will render the language as unsupported.)syler.sass-indented:
This error indicates that the path is wrong and it doesn't exist. Please can you confirm if this exact path exists or not.
Fix parsing JSON files (#17)
Pre release v1.1.13 (#18)
yCodeTech commentedon Dec 8, 2025
@C-512L While I wait for your reply on the syler.sass-indented error. I have published a pre-release (v1.1.13) with the other fixes I spoke about.
C-512L commentedon Dec 8, 2025
The path indeed does not exists. Also reinstalled the
syler.sass-intendedextension to be sure about it.yCodeTech commentedon Dec 9, 2025
@C-512L Hmm. I'm confused then, because it should be in the same directory as it's
package.jsonwhich is where it read thesass.configuration.jsonfrom.It'll help me debug if you could send me the entirety of the dedicated
Auto Comment BlocksOutput channel. Please save the entire log to file using theSave Output Asbutton in the Output's "3-dot menu", and attach the file here. If you're worried about sensitive env variables that are logged for debugging, then you can email the log file if you wish (stuart-norman@hotmail.com)C-512L commentedon Dec 9, 2025
Turned out to be a distribution/bundling problem.
yCodeTech commentedon Dec 10, 2025
@C-512L Ok. I'm glad we found the cause of that issue. I've posted a temporary workaround on the issue. It should work universally with vscodium and others.