SyntaxError: Unexpected end of JSON input

See original GitHub issue

Recently upgraded to the latest and CFN-Lint is reporting the following errors on this portion of my yaml template: AWSTemplateFormatVersion: ‘2010-09-09’

I’ve tried mapping the file extensions to a language but that’s not worked. Also, i’ve tried the following commands:

  • Reinstall : pip uninstall cfn-lint and then pip install cfn-lint
  • Downgrading: pip install --upgrade --force-reinstall cfn-lint==0.35.0 pyrsistent==0.16.0
  • Upgrading since the downgrade failed: pip install --upgrade --force-reinstall cfn-lint

Here is a copy of the problems it is reporting:

[cfn-lint] SyntaxError: Unexpected end of JSON input
Go to https://github.com/aws-cloudformation/cfn-python-lint/#install for more help

{
	"resource": "<Path to .yaml file>",
	"owner": "_generated_diagnostic_collection_name_#3",
	"severity": 4,
	"message": "[cfn-lint] Traceback (most recent call last):\r\n  File \"c:\\program files\\python37\\lib\\runpy.py\", line 193, in _run_module_as_main\r\n    \"__main__\", mod_spec)\r\n  File \"c:\\program files\\python37\\lib\\runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"C:\\Program Files\\Python37\\Scripts\\cfn-lint.exe\\__main__.py\", line 9, in <module>\r\n  File \"c:\\program files\\python37\\lib\\site-packages\\cfnlint\\__main__.py\", line 42, in main\r\n    matches_output = formatter.print_matches(matches)\r\n  File \"c:\\program files\\python37\\lib\\site-packages\\cfnlint\\formatters\\__init__.py\", line 95, in print_matches\r\n    sort_keys=True, separators=(',', ': '))\r\n  File \"c:\\program files\\python37\\lib\\json\\__init__.py\", line 238, in dumps\r\n    **kw).encode(obj)\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 201, in encode\r\n    chunks = list(chunks)\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 429, in _iterencode\r\n    yield from _iterencode_list(o, _current_indent_level)\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 325, in _iterencode_list\r\n    yield from chunks\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 439, in _iterencode\r\n    yield from _iterencode(o, _current_indent_level)\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 431, in _iterencode\r\n    yield from _iterencode_dict(o, _current_indent_level)\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 405, in _iterencode_dict\r\n    yield from chunks\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 439, in _iterencode\r\n    yield from _iterencode(o, _current_indent_level)\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 431, in _iterencode\r\n    yield from _iterencode_dict(o, _current_indent_level)\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 405, in _iterencode_dict\r\n    yield from chunks\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 405, in _iterencode_dict\r\n    yield from chunks\r\n  File \"c:\\program files\\python37\\lib\\json\\encoder.py\", line 438, in _iterencode\r\n    o = _default(o)\r\n  File \"c:\\program files\\python37\\lib\\site-packages\\cfnlint\\formatters\\__init__.py\", line 89, in default\r\n    return {'__{}__'.format(o.__class__.__name__): o.__dict__}\r\nAttributeError: '_yaml.Mark' object has no attribute '__dict__'\r\n\nGo to https://github.com/aws-cloudformation/cfn-python-lint/#install for more help",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 1.7976931348623157e+308
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
felixtheantcommented, Mar 5, 2021

@PatMyron, I have that update pending a restart so I don’t think it’s related and thanks for your help.

1reaction
kddejongcommented, Mar 4, 2021

Errors like this will return as line 1 column 1 but the error likely didn’t actually happen there. Looking at the stack trace it looks like an error is returning something other than a match.

Can you do cfn-lint from the cli against the same template and send me the results.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught SyntaxError: Unexpected end of JSON input
A common error encountered by JavaScript programmers is the Uncaught SyntaxError: Unexpected end of JSON input. This is usually observed when the coder...
Read more >
Uncaught SyntaxError: Unexpected end of JSON input at ...
This is because of the data that you are trying to parse is not in a parsable format . so i suggest to...
Read more >
Unexpected end of JSON input Error in JavaScript | bobbyhadz
The "Unexpected end of JSON input" error occurs when trying to parse invalid JSON using the JSON.parse or $.parseJSON methods. Trying to parse...
Read more >
"Unexpected end of JSON input" - possible fixes - LinuxPip
“Unexpected end of JSON input” (or “Uncaught SyntaxError: Unexpected end of JSON input”) is a common error message in JavaScript, ...
Read more >
Fix the unexpected end of input error in JavaScript - Codedamn
One common cause of unexpected end of JSON input error is simply that the JSON data is not well-formed. This means that there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found