webdev icon indicating copy to clipboard operation
webdev copied to clipboard

Throw a more descriptive error if the metadata can't be found

Open grouma opened this issue 5 years ago • 5 comments

If we can't read the DDC metadata file we get an odd state error:

Thread 0 main threadStateError: Bad state: No element
at List.last(growable_array.dart:255)
at AppInspector._initialize(inspector.dart:90)
at <asynchronous gap>(async)
at AppInspector.initialize(inspector.dart:155)
at <asynchronous gap>(async)
at ChromeProxyService.createIsolate(chrome_proxy_service.dart:180)
at <asynchronous gap>(async)

This is because we get an empty list of libraries. We should implement better logging here and throw a better more descriptive state error.

grouma avatar Nov 30 '20 23:11 grouma

Hmmm. Actually it's not clear to me how we get into this state as we do throw an error if the metadata can't be read: https://github.com/dart-lang/webdev/blob/968e7eb67c3429c07d53ac2a9eba7c5d995fadc2/dwds/lib/src/debugging/metadata/provider.dart#L137

Is it possible that the metadata file is empty? I believe it is synthetically generated in Flutter Tools.

cc @jonahwilliams @annagrin

grouma avatar Dec 01 '20 18:12 grouma

I don't really know what the metadata is used for

jonahwilliams avatar Dec 01 '20 19:12 jonahwilliams

It's used to parse the available modules and other related DDC metadata. I think we can sit on this issue until someone reports it with a verbose trace. Hopefully that will be more enlightening.

grouma avatar Dec 01 '20 19:12 grouma

@grouma do we have a repro to play with, or detailed logs?

annagrin avatar Dec 08 '20 18:12 annagrin

This report is coming from our Flutter analytics. We don't get much more than the stack trace and platform. It's a transient issue so I don't have a repo yet.

grouma avatar Dec 08 '20 18:12 grouma