Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge_strict_job exception: Utils_js.Key_not_found #3147

Closed
ForbesLindesay opened this issue Jan 7, 2017 · 16 comments
Closed

merge_strict_job exception: Utils_js.Key_not_found #3147

ForbesLindesay opened this issue Jan 7, 2017 · 16 comments
Assignees
Labels

Comments

@ForbesLindesay
Copy link
Contributor

I get errors like this when I run flow:

src/server-rendering.js:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/Users/forbeslindesay/GitHub/bicycle/src/messages.js")
Raised at file "hashtbl.ml", line 136, characters 19-28
@gcazaciuc
Copy link

i have seen this error also multiple times but usually after making changes in libdefs and especially if i had a syntax error in them previously.

@gabelevi
Copy link
Contributor

gabelevi commented Jan 7, 2017

merge_strict_job exceptions are always bugs in Flow. Whenever they appear we'd like to repro them and fix them.

Does this happen when the Flow server starts up (when you run flow for the first time or when you run flow check) or when you do a recheck (like when you touch a file and Flow incrementally checks the changes)? Steps to repro would be greatly appreciated!

We did introduce a bunch of these kinds of errors in v0.37.0, as part of the recheck optimization. By 0.37.4 we've fixed a bunch of them, but are still aware of a couple. So any repros would be greatly appreciated!

@ForbesLindesay
Copy link
Contributor Author

Always when I'm running flow for at leas the second or third time after making a few changes. running flow stop && flow seems to consistently fix the issue.

Another thing that seems to normally happen at the same time is that flow complains that at least one of my // $FlowFixMe comments is not needed, when it actually is required.

It does seem to mostly occur when editing code in the files referenced by [libs], but I don't have a consistent repro (partly because it always goes away when I restart the flow server).

@STRML
Copy link
Contributor

STRML commented Jan 9, 2017

I have the same issue, usually happens about the third time running flow. Not always caused by [libs], or even changes to greatly shared modules. When it happens, I get about 70 errors, which then go away by stopping & starting.

This is new as of 0.37.0 (running 0.37.4 now).

An example of some:

ui/views/market/Leaderboard.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/project/ui/views/widgets/Page.jsx")


ui/views/market/Leaderboard.jsx:93
 93:           // $FlowIgnore: Indexable signature
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error suppressing comment. Unused suppression

ui/views/market/PriceIndex.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/project/ui/views/widgets/Page.jsx")


ui/views/market/SettlementHistory.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/project/ui/views/widgets/Page.jsx")


ui/views/market/SymbolBreakdown.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Failure("find_root: tvar 2518045 not found in file /project/ui/views/market/SymbolBreakdown.jsx")


ui/views/routers/SidebarRouter.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/project/ui/views/widgets/sidebars/index.js")


ui/views/static/StaticWrapper.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/project/ui/views/widgets/Page.jsx")


ui/views/trade/AdvancedTradeLayout.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/project/ui/views/trade/OrderbookPanel.jsx")


ui/views/trade/MarginPanel.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Failure("find_root: tvar 2518045 not found in file /project/ui/views/trade/MarginPanel.jsx")


ui/views/trade/OrderbookPanel.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/project/ui/views/widgets/options/OrderBookOptionsDropdown.jsx")


ui/views/trade/TradeLayoutWrapper.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Utils_js.Key_not_found("LeaderHeap", "/project/ui/views/trade/OrderbookPanel.jsx")


ui/views/widgets/Page.jsx:1
  1: // @flow
     ^ merge_strict_job exception: Failure("find_root: tvar 2518045 not found in file "/project/ui/views/widgets/Page.jsx")

@gabelevi
Copy link
Contributor

gabelevi commented Jan 9, 2017

@avikchaudhuri is investigating and will get a fix into 0.38.0

@STRML
Copy link
Contributor

STRML commented Jan 18, 2017

Unfortunately this is still happening in 0.38.0 :(

@gabelevi
Copy link
Contributor

CC @avikchaudhuri

@STRML - do you have a repository that we could look at? Given a repo and Flow's logs during the exception, @avikchaudhuri has had success in the past reproducing the issue.

Long story short, starting in v0.37.0, Flow tries to avoid rechecking a module if none of its dependencies have substantially changed. However if Flow is wrong about the "substantially changed" part, it can cause trouble like this.

@STRML
Copy link
Contributor

STRML commented Jan 25, 2017

I can't seem to reproduce this yet. It's a very large/complicated project and I can't trade it down yet to a single file or circular dep.

To give some background, we usually keep a lot of our large/complicated types in a single file so they are easy to import into other modules. Things like the shape of the data tree (React project), collections, models, action definitions, and so on. So when changing some much depended-upon modules (such as a Flux Store or one of the base classes) I see Flow actually fall back from merging inference to processing. When that happens, these errors occur.

@mrazorvin
Copy link

mrazorvin commented Jan 31, 2017

I got the same exception with typeof operator. Flow-bin v0.38.0

// Exception
function likeObject(item: any): Boolean {
  return (item !== null && typeof item === 'object' && !Array.isArray(item));
}

// Ok
function likeObject(item: any): Boolean {
  const notArray = !Array.isArray(item);
  return notArray && item && typeof item === 'object';
}

Exception message:

1: /**
 ^ merge_strict_job exception: Failure("add_output: no source for error: [\n  {\n    \"kind\":\"infer\",\n    \"level\":\"error\",\n    \"message\":[\n      {\n        \"descr\":\"boolean\",\n        \"type\":\"Blame\",\n        \"path\":\"\",\n        \"line\":0,\n        \"endline\":0,\n        \"start\":1,\n        \"end\":0\n      },\n      {\n        \"descr\":\"This type is incompatible with the expected return type of\",\n        \"type\":\"Comment\",\n        \"path\":\"\",\n        \"line\":0,\n        \"endline\":0,\n        \"start\":1,\n        \"end\":0\n      },\n      {\n        \"descr\":\"Boolean\",\n        \"type\":\"Blame\",\n        \"loc\":{\n          \"source\":\"/home/mikhail/Projects/webgine_schemas/application/components/DefinitionResolver/index.js\",\n          \"type\":\"SourceFile\",\n          \"start\":{\"line\":17,\"column\":42,\"offset\":322},\n          \"end\":{\"line\":17,\"column\":48,\"offset\":329}\n        },\n        \"path\":\"/home/mikhail/Projects/webgine_schemas/application/components/DefinitionResolver/index.js\",\n        \"line\":17,\n        \"endline\":17,\n        \"start\":42,\n        \"end\":48\n      }\n    ]\n  }\n]")

@STRML
Copy link
Contributor

STRML commented Jan 31, 2017

@Shok211 That appears to be related to your use of Boolean (rather than boolean). Fixing the type fixes the error.

@avikchaudhuri
Copy link
Contributor

avikchaudhuri commented Jan 31, 2017 via email

facebook-github-bot pushed a commit that referenced this issue Jan 31, 2017
Summary:
We use BoolT.t in various places. When these are part of errors, their
locationlessness causes an assertion failure.

Will follow up with a more thorough audit of the locationless Primitive
type constructor `t` (also available on NumT, StrT, ...).

Ref #3147

Reviewed By: samwgoldman

Differential Revision: D4490639

fbshipit-source-id: 23f6531e24acf0bd7f8f36fbe9defd5876736ee4
@fionawhim
Copy link

fionawhim commented Feb 21, 2017

I'm seeing this sort of thing as well, with Flow 0.39.0. Restarting the Flow server has no effect.

➜  311 git:(feature/report-flow) yarn flow check
yarn flow v0.20.3
$ "/Users/FinneganHopkins/Source/311/node_modules/.bin/flow" check
(11046) merge_strict_job THROWS: [1] /Users/FinneganHopkins/Source/311/pages/report.js: Failure("find_root: tvar 118125 not found in file /Users/FinneganHopkins/Source/311/pages/report.js")


(11047) merge_strict_job THROWS: [1] /Users/FinneganHopkins/Source/311/pages/report.test.js: Utils_js.Key_not_found("LeaderHeap", "/Users/FinneganHopkins/Source/311/pages/report.js")

I don't have a minimal test case, but if you want to repro you can check out the code from here: https://github.com/CityOfBoston/311/tree/flow-internal-error

LMK if there’s other info I can provide. This popped up when I was moving things around in the components directory, renaming some of the subdirectories and moving 2 containers to be index.js files.

There may be typechecking errors in there, but I assume you'd rather report those than have an internal error. :)

EDIT: The issues seem to be around checking whether service is null or not, here: https://github.com/CityOfBoston/311/blob/flow-internal-error/components/report-form/ReportFormDialog.js#L55

EDIT: I narrowed it down to the presence of $NonMaybeType on this line: https://github.com/CityOfBoston/311/blob/flow-internal-error/data/types.js#L12

By replacing the definition of Service with the object literal from inside the schema.flow.js file, the errors go away. (I made a little test and it seems to be $NonMaybeType and not $PropertyType that's the issue).

This code had worked before, however. There must be something new in the changes I've made in the components directory that's exposing the bug.

@imranolas
Copy link

@finneganh In my case, the error occurs when using $PropertyType only.

@AlexanderTserkovniy
Copy link

In my case it was removing emoji=true option from .flowconfig solved the problem.

@fakenickels
Copy link

fakenickels commented Sep 6, 2017

In my case was a node_modules accidentally added to flow-typed dir

@goodmind goodmind added the Crash label May 24, 2019
@mroch
Copy link
Contributor

mroch commented Dec 2, 2022

please reopen a fresh issue if this is still an issue!

@mroch mroch closed this as completed Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests