vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.54k stars 659 forks source link

UnexpectedValueException: Expecting non-empty $root_file_path and $checked_file_path #10451

Open M393 opened 9 months ago

M393 commented 9 months ago

This error is logged occasionally when hovering elements with the VSCode extension. This time it repeatedly happened when hovering over a specific call to file_get_contents. Other elements worked fine. Making a change and reverting sometimes 'fixes' it.

7246 seems to describe a similar problem, but in my case it doesn't seem related to live typing as it happened repeatedly, even when the file is not changed for some time.

[Error - 2:26:44 PM] UnexpectedValueException: Expecting non-empty $root_file_path and $checked_file_path in C:\project\vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Functions.php:120
Stack trace:
#0 C:\project\vendor\vimeo\psalm\src\Psalm\Codebase.php(1120): Psalm\Internal\Codebase\Functions->getStorage(NULL, 'file_get_conten...')
#1 C:\project\vendor\vimeo\psalm\src\Psalm\Internal\LanguageServer\Server\TextDocument.php(254): Psalm\Codebase->getMarkupContentForSymbolByReference(Object(Psalm\Internal\LanguageServer\Reference))
#2 C:\project\vendor\felixfbecker\advanced-json-rpc\lib\Dispatcher.php(168): Psalm\Internal\LanguageServer\Server\TextDocument->hover(Object(LanguageServerProtocol\TextDocumentIdentifier), Object(LanguageServerProtocol\Position))
#3 C:\project\vendor\vimeo\psalm\src\Psalm\Internal\LanguageServer\LanguageServer.php(199): AdvancedJsonRpc\Dispatcher->dispatch(Object(AdvancedJsonRpc\Request))
#4 [internal function]: Psalm\Internal\LanguageServer\LanguageServer->Psalm\Internal\LanguageServer\{closure}(Object(Psalm\Internal\LanguageServer\Message))
#5 C:\project\vendor\amphp\amp\lib\Coroutine.php(67): Generator->current()
#6 C:\project\vendor\amphp\amp\lib\functions.php(96): Amp\Coroutine->__construct(Object(Generator))
#7 C:\project\vendor\amphp\amp\lib\functions.php(61): Amp\call(Object(Closure), Object(Psalm\Internal\LanguageServer\Message))
#8 C:\project\vendor\vimeo\psalm\src\Psalm\Internal\LanguageServer\EmitterTrait.php(85): Amp\{closure}(Object(Psalm\Internal\LanguageServer\Message))
#9 C:\project\vendor\vimeo\psalm\src\Psalm\Internal\LanguageServer\ProtocolStreamReader.php(116): Psalm\Internal\LanguageServer\ProtocolStreamReader->emit('message', Array)
#10 C:\project\vendor\vimeo\psalm\src\Psalm\Internal\LanguageServer\ProtocolStreamReader.php(63): Psalm\Internal\LanguageServer\ProtocolStreamReader->readMessages('Content-Length:...')
#11 [internal function]: Psalm\Internal\LanguageServer\ProtocolStreamReader->Psalm\Internal\LanguageServer\{closure}()
#12 C:\project\vendor\amphp\amp\lib\Coroutine.php(118): Generator->send('Content-Length:...')
#13 C:\project\vendor\amphp\amp\lib\Internal\Placeholder.php(149): Amp\Coroutine->Amp\{closure}(NULL, 'Content-Length:...')
#14 C:\project\vendor\amphp\amp\lib\Deferred.php(53): Amp\Promise@anonymous->resolve('Content-Length:...')
#15 C:\project\vendor\amphp\byte-stream\lib\ResourceInputStream.php(101): Amp\Deferred->resolve('Content-Length:...')
#16 C:\project\vendor\amphp\amp\lib\Loop\NativeDriver.php(327): Amp\ByteStream\ResourceInputStream::Amp\ByteStream\{closure}('a', Resource id #186, NULL)
#17 C:\project\vendor\amphp\amp\lib\Loop\NativeDriver.php(127): Amp\Loop\NativeDriver->selectStreams(Array, Array, -0.001)
#18 C:\project\vendor\amphp\amp\lib\Loop\Driver.php(138): Amp\Loop\NativeDriver->dispatch(true)
#19 C:\project\vendor\amphp\amp\lib\Loop\Driver.php(72): Amp\Loop\Driver->tick()
#20 C:\project\vendor\amphp\amp\lib\Loop.php(95): Amp\Loop\Driver->run()
#21 C:\project\vendor\vimeo\psalm\src\Psalm\Internal\LanguageServer\LanguageServer.php(334): Amp\Loop::run()
#22 C:\project\vendor\vimeo\psalm\src\Psalm\Internal\Cli\LanguageServer.php(417): Psalm\Internal\LanguageServer\LanguageServer::run(Object(Psalm\Config), Object(Psalm\Internal\LanguageServer\ClientConfiguration), 'C:\\git-p4\\NavDi...', Object(Psalm\Internal\LanguageServer\PathMapper), false)
#23 C:\project\vendor\vimeo\psalm\psalm-language-server(9): Psalm\Internal\Cli\LanguageServer::run(Array)
#24 {main}
psalm-github-bot[bot] commented 9 months ago

Hey @M393, can you reproduce the issue on https://psalm.dev ?