question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

parser crashes with comment at beginning of file

See original GitHub issue

Using latest version from master

test.sql

-- comment at beginning of file
select * from my_table

Last part of traceback

  File "...\.venv\src\sqlfluff\src\sqlfluff\rules\std.py", line 1760, in _eval
    if last_seg.type == 'comma':
AttributeError: 'NoneType' object has no attribute 'type'

Problem persists even with block /**/ comment

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
pwildenhaincommented, Feb 4, 2021

Interesting! Would you mind trying with the pre release version? pip install sqlfluff --pre

0reactions
davehowellcommented, Feb 4, 2021

Tried with the pre, different error, and it happens twice for the same rule in the same code-path:

sqlfluff/core/rules/std.py", line 2133, in _last_code_seg
    if raw_stack[idx].is_code or raw_stack[idx].is_type("newline"):
IndexError: tuple index out of range
== [models/staging/test.sql] FAIL
L:   1 | P:  37 | L019 | Unexpected exception: tuple index out of range; Could you open an
                       | issue at https://github.com/sqlfluff/sqlfluff/issues ? You can
                       | ignore this exception for now, by adding '--noqa: L019' at the end
                       | of line 1
L:   2 | P:   1 | L019 | Unexpected exception: tuple index out of range; Could you open an
                       | issue at https://github.com/sqlfluff/sqlfluff/issues ? You can
                       | ignore this exception for now, by adding '--noqa: L019' at the end
                       | of line 2
Read more comments on GitHub >

github_iconTop Results From Across the Web

INI Parser crashes with `segmentation fault` after opening ...
I am making an INI parser that will save all sections in an array for later use. The problem I am running into...
Read more >
Clangd repeatedly crashing on a single file after ...
After restarting, the file it crashed on originally will continue to crash clangd, whereas other files will be fine.
Read more >
VS 2017 RC crashes while parsing included files
You are able to get the files with the following steps: 1. Start Visual Studio. 2. Start another instance of VS. 3. Select...
Read more >
Attacking the batch file parser - The Old New Thing
Another scenario is that an attacker convinces a naïve user to type the specific malformed command line and cause their command prompt to...
Read more >
Papa Parse - Powerful CSV Parser for JavaScript
The world's first multi-threaded CSV parser for the browser. Papa can handle files gigabytes in size without crashing. Use Papa when performance, privacy, ......
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