Skip to content

[BUG]: Extension startup crash - error: "Cannot convert undefined or null to object" #14

Closed

Description

@C-512L

Tested on VSCodium 1.106.37943

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)

Activity

  1. changed the title [-][BUG]: Extension startup crash[/-] [+][BUG]: Extension startup crash - error: "Cannot convert undefined or null to object"[/+] on Dec 3, 2025
  2. yCodeTech commented on Dec 5, 2025

    @yCodeTech
    Owner

    @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.

  3. added a commit that references this issue on Dec 5, 2025
    31c7f51
  4. added a commit that references this issue on Dec 5, 2025
    08de8ee
  5. yCodeTech commented on Dec 5, 2025

    @yCodeTech
    Owner

    @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.

  6. C-512L commented on Dec 5, 2025

    @C-512L
    Author

    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'
    
  7. yCodeTech commented on Dec 7, 2025

    @yCodeTech
    Owner

    @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.

  8. linked a pull request that will close this issueFix parsing JSON files #17on Dec 7, 2025
  9. yCodeTech commented on Dec 8, 2025

    @yCodeTech
    Owner

    @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.

  10. C-512L commented on Dec 8, 2025

    @C-512L
    Author

    The path indeed does not exists. Also reinstalled the syler.sass-intended extension to be sure about it.

  11. pinned this issue on Dec 9, 2025
  12. unpinned this issue on Dec 9, 2025
  13. yCodeTech commented on Dec 9, 2025

    @yCodeTech
    Owner

    @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)

  14. C-512L commented on Dec 9, 2025

    @C-512L
    Author

    Turned out to be a distribution/bundling problem.

  15. yCodeTech commented on Dec 10, 2025

    @yCodeTech
    Owner

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions