Skip to content

bug(flow): AttributeError: 'tuple' object has no attribute 'error_type' #79

@Kristinita

Description

@Kristinita

1. Summary

SublimeLinter-flow incorrectly handles Flow output in 2025. I get the error AttributeError: 'tuple' object has no attribute 'error_type'.

2. MCVE

2.1. Files

The file kira-example.js with intentionally incorrect type annotations:

// @flow
var whoIsAGoddess;

whoIsAGoddess = function(goddessName/*: number */)/*: boolean */ {
    return `${goddessName} is a Goddess!`;
};

console.log(whoIsAGoddess("Kira"));

Flow also requires the file .flowconfig in the same directory as kira-example.js. This file may be empty.

2.2. Terminal output

D:\SashaDebugging\KiraFlow>flow kira-example.js
Launching Flow server for D:\SashaDebugging\KiraFlow
Spawned flow server (pid=19432)
Logs will go to C:\Users\SashaChernykh\AppData\Local\Temp\flow\DzCzBSashaDebuggingzBKiraFlow.log
Monitor logs will go to C:\Users\SashaChernykh\AppData\Local\Temp\flow\DzCzBSashaDebuggingzBKiraFlow.monitor_log
Error --------------------------------------------------------------------------------------------- kira-example.js:5:12

Cannot return template string because string [1] is incompatible with boolean [2]. [incompatible-type]

   kira-example.js:5:12
   5|     return `${goddessName} is a Goddess!`;
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]

References:
   kira-example.js:4:55
   4| whoIsAGoddess = function(goddessName/*: number */)/*: boolean */ {
                                                            ^^^^^^^ [2]


Error --------------------------------------------------------------------------------------------- kira-example.js:8:27

Cannot call `whoIsAGoddess` with `"Kira"` bound to `goddessName` because string [1] is incompatible with number [2].
[incompatible-type]

   kira-example.js:8:27
   8| console.log(whoIsAGoddess("Kira"));
                                ^^^^^^ [1]

References:
   kira-example.js:4:41
   4| whoIsAGoddess = function(goddessName/*: number */)/*: boolean */ {
                                              ^^^^^^ [2]



Found 2 errors

2.3. Steps to reproduce

  1. Launch Sublime Text 4 on Windows in the Safe Mode.

  2. Install Package Control.

  3. Ctrl+Shift+PPackage Control: Upgrade/Overwrite All Packages.

    Otherwise, I get the error Package Control: The dependency 'typing_extensions' is not available when I install SublimeLinter through Package Control.

  4. Install SublimeLinter and SublimeLinter-flow using Package Control.

  5. Ctrl+Shift+PSublimeLinter: Reload SublimeLinter and its Plugins.

    Otherwise, SublimeLinter plugins don’t work, and I get the message SublimeLinter upgrade in progress. Aborting lint. in the status bar.

  6. Ctrl+Shift+PPreferences: SublimeLinter Settings → replace the content of the user settings file on the right side with this content:

    {
    	"debug": true
    }
  7. Select File in the Sublime menu → Open file → open the file kira-example.js.

  8. Install AutomaticPackageReloader using Package Control. Ctrl+Shift+PAutomatic Package Reloader → add the text SublimeLinter-flow in the opened input field with the label Package:Enter.

    Otherwise, SublimeLinter-flow doesn’t lint files. I get this output in the Sublime Text console:

    SublimeLinter: backend.py:75          Delay linting 'kira-example.js' for 0.3s
    SublimeLinter: backend.py:75          Delay linting 'kira-example.js' for 0.3s
    SublimeLinter: backend.py:99          No installed linter matches the view.
    SublimeLinter: backend.py:99          No installed linter matches the view.

    NOTE: SublimeLinter duplicates messages in the debug mode.

  9. When the file kira-example.js is opened in the current view, open the Sublime Text Python console.

2.4. Sublime console output

I get this output in the Sublime Text console:

SublimeLinter: #1 linter.py:55        found flow pragma!
SublimeLinter: #1 linter.py:55        found flow pragma!
SublimeLinter: #1 linter.py:1704      Running …

  D:\SashaDebugging\KiraFlow  (working dir)
  > type kira-example.js | "C:\Program Files\nodejs\flow.CMD" check-contents D:\SashaDebugging\KiraFlow\kira-example.js --show-all-errors --json

SublimeLinter: #1 linter.py:1704      Running …

  D:\SashaDebugging\KiraFlow  (working dir)
  > type kira-example.js | "C:\Program Files\nodejs\flow.CMD" check-contents D:\SashaDebugging\KiraFlow\kira-example.js --show-all-errors --json
SublimeLinter: #1 linter.py:1238      flow: output:
  [{"flowVersion":"0.295.0","jsonVersion":"1","errors":[{"kind":"infer","level":"error","suppressions":[],"extra":[{"message":[{"context":null,"descr":"References:","type":"Blame","path":"","line":0,"endline":0,"start":1,"end":0}]},{"message":[{"context":"    return `${goddessName} is a Goddess!`;","descr":"[1]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":5,"column":12,"offset":107},"end":{"line":5,"column":41,"offset":137}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":5,"endline":5,"start":12,"end":41}]},{"message":[{"context":"whoIsAGoddess = function(goddessName/*: number */)/*: boolean */ {","descr":"[2]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":4,"column":55,"offset":83},"end":{"line":4,"column":61,"offset":90}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":4,"endline":4,"start":55,"end":61}]}],"message":[{"context":"    return `${goddessName} is a Goddess!`;","descr":"Cannot return template string because string [1] is incompatible with boolean [2]. [incompatible-type]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":5,"column":12,"offset":107},"end":{"line":5,"column":41,"offset":137}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":5,"endline":5,"start":12,"end":41}],"error_codes":["incompatible-type"]},{"kind":"infer","level":"error","suppressions":[],"extra":[{"message":[{"context":null,"descr":"References:","type":"Blame","path":"","line":0,"endline":0,"start":1,"end":0}]},{"message":[{"context":"console.log(whoIsAGoddess(\"Kira\"));","descr":"[1]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":8,"column":27,"offset":169},"end":{"line":8,"column":32,"offset":175}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":8,"endline":8,"start":27,"end":32}]},{"message":[{"context":"whoIsAGoddess = function(goddessName/*: number */)/*: boolean */ {","descr":"[2]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":4,"column":41,"offset":69},"end":{"line":4,"column":46,"offset":75}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":4,"endline":4,"start":41,"end":46}]}],"message":[{"context":"console.log(whoIsAGoddess(\"Kira\"));","descr":"Cannot call `whoIsAGoddess` with `\"Kira\"` bound to `goddessName` because string [1] is incompatible with number [2]. [incompatible-type]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":8,"column":27,"offset":169},"end":{"line":8,"column":32,"offset":175}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":8,"endline":8,"start":27,"end":32}],"error_codes":["incompatible-type"]}],"passed":false},{}]
SublimeLinter: #1 linter.py:1238      flow: output:
  [{"flowVersion":"0.295.0","jsonVersion":"1","errors":[{"kind":"infer","level":"error","suppressions":[],"extra":[{"message":[{"context":null,"descr":"References:","type":"Blame","path":"","line":0,"endline":0,"start":1,"end":0}]},{"message":[{"context":"    return `${goddessName} is a Goddess!`;","descr":"[1]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":5,"column":12,"offset":107},"end":{"line":5,"column":41,"offset":137}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":5,"endline":5,"start":12,"end":41}]},{"message":[{"context":"whoIsAGoddess = function(goddessName/*: number */)/*: boolean */ {","descr":"[2]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":4,"column":55,"offset":83},"end":{"line":4,"column":61,"offset":90}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":4,"endline":4,"start":55,"end":61}]}],"message":[{"context":"    return `${goddessName} is a Goddess!`;","descr":"Cannot return template string because string [1] is incompatible with boolean [2]. [incompatible-type]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":5,"column":12,"offset":107},"end":{"line":5,"column":41,"offset":137}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":5,"endline":5,"start":12,"end":41}],"error_codes":["incompatible-type"]},{"kind":"infer","level":"error","suppressions":[],"extra":[{"message":[{"context":null,"descr":"References:","type":"Blame","path":"","line":0,"endline":0,"start":1,"end":0}]},{"message":[{"context":"console.log(whoIsAGoddess(\"Kira\"));","descr":"[1]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":8,"column":27,"offset":169},"end":{"line":8,"column":32,"offset":175}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":8,"endline":8,"start":27,"end":32}]},{"message":[{"context":"whoIsAGoddess = function(goddessName/*: number */)/*: boolean */ {","descr":"[2]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":4,"column":41,"offset":69},"end":{"line":4,"column":46,"offset":75}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":4,"endline":4,"start":41,"end":46}]}],"message":[{"context":"console.log(whoIsAGoddess(\"Kira\"));","descr":"Cannot call `whoIsAGoddess` with `\"Kira\"` bound to `goddessName` because string [1] is incompatible with number [2]. [incompatible-type]","type":"Blame","loc":{"source":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","type":"SourceFile","start":{"line":8,"column":27,"offset":169},"end":{"line":8,"column":32,"offset":175}},"path":"D:\\SashaDebugging\\KiraFlow\\kira-example.js","line":8,"endline":8,"start":27,"end":32}],"error_codes":["incompatible-type"]}],"passed":false},{}]
SublimeLinter: #1 linter.py:291       flow 2 errors. passed: False
SublimeLinter: #1 linter.py:291       flow 2 errors. passed: False
SublimeLinter: #1 linter.py:137       flow line: 4, col: 11, level: error, message: `${goddessName} is a Goddess!` (Cannot return template string because string [1] is incompatible with boolean [2]. [incompatible-type])
SublimeLinter: #1 linter.py:137       flow line: 4, col: 11, level: error, message: `${goddessName} is a Goddess!` (Cannot return template string because string [1] is incompatible with boolean [2]. [incompatible-type])
SublimeLinter: #1 backend.py:257      ERROR: Unhandled exception:
Traceback (most recent call last):
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/backend.py", line 245, in execute_lint_task
    errors = linter.lint(code, view_has_changed)
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1178, in lint
    return self.filter_errors(self.parse_output(output, virtual_view))
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1201, in filter_errors
    return [
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1201, in <listcomp>
    return [
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1242, in parse_output_via_regex
    if error := self.process_match(m, virtual_view):
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1349, in process_match
    error_type = m.error_type or self.get_error_type(m.error, m.warning)
AttributeError: 'tuple' object has no attribute 'error_type'
SublimeLinter: #1 backend.py:257      ERROR: Unhandled exception:
Traceback (most recent call last):
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/backend.py", line 245, in execute_lint_task
    errors = linter.lint(code, view_has_changed)
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1178, in lint
    return self.filter_errors(self.parse_output(output, virtual_view))
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1201, in filter_errors
    return [
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1201, in <listcomp>
    return [
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1242, in parse_output_via_regex
    if error := self.process_match(m, virtual_view):
  File "G:\SublimeText\Data (Safe Mode)\Installed Packages\SublimeLinter.sublime-package\lint/linter.py", line 1349, in process_match
    error_type = m.error_type or self.get_error_type(m.error, m.warning)
AttributeError: 'tuple' object has no attribute 'error_type'
SublimeLinter: backend.py:460         Linting 'kira-example.js' with flow took 0.80s
SublimeLinter: backend.py:460         Linting 'kira-example.js' with flow took 0.80s

3. Environment

  1. Windows 11, Version 25H2 (OS Build 26200.7171)
  2. Sublime Text 4, Build 4200 (Stable Channel)
  3. SublimeLinter 4.82.2
  4. Flow 0.295.0
  5. SublimeLinter-flow 4.5.7

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions