dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.3k stars 1.59k forks source link

Crash when doing build runner #37776

Open venkata-ramana opened 5 years ago

venkata-ramana commented 5 years ago

Error

PS C:\code> flutter packages pub run build_runner build
Unable to spawn isolate: Crash when compiling null,
at character offset null:
.dart_tool/pub/bin/build_runner/build_runner.dart.snapshot.dart2:196:900: Internal problem: Unhandled AmbiguousBuilder in pushQualifiedReference.
�y��s�╔�qO╔
pub finished with exit code 1

Flutter doctor

PS C:\code> flutter doctor -v
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.17763.615], locale en-US)
    • Flutter version 1.7.8+hotfix.4 at D:\Src\flutter-hotfix3
    • Framework revision 20e59316b8 (3 weeks ago), 2019-07-18 20:04:33 -0700
    • Engine revision fee001c93f
    • Dart version 2.4.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\Venkat\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.4)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 35.2.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] VS Code (version 1.36.1)
    • VS Code at C:\Users\Venkat\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.3.0

[√] Connected device (1 available)
    • ONEPLUS A6000 • 4e276308 • android-arm64 • Android 9 (API 28)
jakemac53 commented 5 years ago

This doesn't look like a package:build issue I don't think, it looks like maybe you are running into the multiple global package cache issue due to the fact that flutter ships with a pre-populated global pub cache of its own which causes tons of problems.

Can you try deleting that one (it lives under your flutter sdk at .pub_cache). Then rerun flutter packages pub upgrade and flutter packages pub run build_runner build.

venkata-ramana commented 5 years ago

No luck, Same issue. Did everything mentioned above.

jakemac53 commented 5 years ago

Ok, in that case this is probably a dart vm issue or something, specifically this part seems to be the problem Internal problem: Unhandled AmbiguousBuilder in pushQualifiedReference. which is happening when trying to run the snapshot.

jakemac53 commented 5 years ago

This could also be a CFE error potentially, but ill let the vm team diagnose.

zichangg commented 5 years ago

From the error message,

if (qualifier is TypeUseGenerator) {
  type = qualifier;
  if (typeArguments != null) {
    // TODO(ahe): Point to the type arguments instead.
    addProblem(fasta.messageConstructorWithTypeArguments,
        identifier.charOffset, identifier.name.length);
  }
} else if (qualifier is Generator) {
  type = qualifier.qualifiedLookup(deprecated_extractToken(identifier));
  identifier = null;
} else {
  unhandled("${qualifier.runtimeType}", "pushQualifiedReference",
      start.charOffset, uri);
}

Here looks like the place generating the error. https://github.com/dart-lang/sdk/blob/81e98dd47b2b1ce12cf725efd2dd4762ea909e6f/pkg/front_end/lib/src/fasta/kernel/body_builder.dart#L3410

mraleph commented 5 years ago

Reduction:

 class X { const X.foo(); }
 class X { const X.foo(); }

 void main() {
   const X.foo();
 }

@johnniwinther Johnni, could you take a look? Seems really unsafe if in random places we can get AmbigiousBuilder.

@jakemac53 note that this means that there is a syntactic error in the code that CFE is trying to parse (it does not help though that we don't get any useful position information). Maybe some of the code that build_runner generates internally is wrong.

@venkata-ramana does you code pass flutter analyze without errors?

venkata-ramana commented 5 years ago

Yes, it does. I even tried using Flutter version 1.7.8+hotfix.3 but build runner throwing same exception.

mraleph commented 5 years ago

@venkata-ramana can you search for build.dart in your folder (should be in .dart_tool/build/entrypoint/build.dart) and post it here?

venkata-ramana commented 5 years ago

I didn't find build.dart under .dart-tool instead I got build_runner.dart.snapshot.dart2 shall I send you this?

jakemac53 commented 5 years ago

It looks like this is failing not on the build script itself but the build_runner entrypoint (at bin/build_runner.dart under that package). This is the thing that creates the build script and snapshots it.

mraleph commented 5 years ago

@venkata-ramana yes please start by uploading that snapshot somewhat - that might shed some light on the issue you are seeing.

[btw just to verify - does the issue persist if you purge this snapshot file?]

venkata-ramana commented 5 years ago

The issue still persists after removing all those files. I even tried the latest code, Upgraded packages, cleared the app data.

if I create the new project It is working fine. am I missing something here?

mraleph commented 5 years ago

@venkata-ramana as I said - lets start by looking at build_runner.dart.snapshot.dart2 - could you upload this somewhere?

venkata-ramana commented 5 years ago

Uploaded it here have a look https://github.com/venkata-ramana/build_runnner_isolator/tree/master/.dart_tool/pub/bin/bin/build_runner

mraleph commented 5 years ago

@venkata-ramana can you post output of these two commands:

> D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe --version
> D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe .dart_tool\pub\bin\bin\build_runner\build_runner.dart.snapshot.dart2

Note: you would need to execute the second command in your project folder (where it previously failed).

If the second command fails also try:

> D:\src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe C:\Users\Venkat\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\build_runner-1.6.2\bin\build_runner.dart
venkata-ramana commented 5 years ago

D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe --version Dart VM version: 2.4.0 (Wed Jun 19 11:53:45 2019 +0200) on "windows_x64"

Unable to run below two commands D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe .dart_tool\pub\bin\bin\build_runner\build_runner.dart.snapshot.dart2 -- build runner usage wrong

D:\src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe C:\Users\Venkat\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\build_runner-1.6.2\bin\build_runner.dart

Error: Could not resolve the package 'args' in 'package:args/args.dart'. Error: Could not resolve the package 'args' in 'package:args/command_runner.dart'. Error: Could not resolve the package 'io' in 'package:io/ansi.dart'. Error: Could not resolve the package 'io' in 'package:io/io.dart'. Error: Could not resolve the package 'logging' in 'package:logging/logging.dart'. Error: Could not resolve the package 'build_runner' in 'package:build_runner/src/build_script_generate/bootstrap.dart'. Error: Could not resolve the package 'build_runner' in 'package:build_runner/src/entrypoint/runner.dart'. Error: Could not resolve the package 'build_runner' in 'package:build_runner/src/logging/std_io_logging.dart'. file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/build_runner-1.6.2/bin/build_runner.dart:8:8: Error: Not found: 'package:args/args.dart' import 'package:args/args.dart'; ^ file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/build_runner-1.6.2/bin/build_runner.dart:9:8: Error: Not found: 'package:args/command_runner.dart' import 'package:args/command_runner.dart';

mraleph commented 5 years ago

@venkata-ramana

What about

D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe .dart_tool\pub\bin\bin\build_runner\build_runner.dart.snapshot.dart2 build

(note additional build)

This should be completely equivalent to flutter pub run build_runner build.

venkata-ramana commented 5 years ago

Throwing error "The system cannot find the path specified.", But the file does exist.

mraleph commented 5 years ago

What if you rewrite it as

D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe ./.dart_tool/pub/bin/bin/build_runner/build_runner.dart.snapshot.dart2 build
venkata-ramana commented 5 years ago

It worked partially

D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe ./.dart_tool/pub/bin/build_runner/build_runner.dart.snapshot.dart2 build

[INFO] Generating build script completed, took 309ms [INFO] Creating build script snapshot... completed, took 12.8s

Asset graph creation not started and above command runs forever

mraleph commented 5 years ago

Something is really strange here. @jakemac53 can you think about the ways to debug this?

venkata-ramana commented 5 years ago

I killed the process and ran the command again

[INFO] Generating build script completed, took 438ms [WARNING] Deleted previous snapshot due to missing asset graph. [INFO] Creating build script snapshot... completed, took 30.5s [WARNING] Error spawning build script isolate, this is likely due to a Dart SDK update. Deleting snapshot and retrying... [INFO] Generating build script...

mraleph commented 5 years ago

@venkata-ramana with this do you get .dart_tool/build/entrypoint/build.dart in your folder?

venkata-ramana commented 5 years ago

yes i got it

mraleph commented 5 years ago

Could you post it?

venkata-ramana commented 5 years ago
// ignore_for_file: directives_ordering

import 'package:build_runner_core/build_runner_core.dart' as _i1;
import 'package:kiwi_generator/builder.dart' as _i2;
import 'package:source_gen/builder.dart' as _i3;
import 'package:jaguar_serializer_cli/builder.dart' as _i4;
import 'package:build_config/build_config.dart' as _i5;
import 'dart:isolate' as _i6;
import 'package:build_runner/build_runner.dart' as _i7;
import 'dart:io' as _i8;

final _builders = <_i1.BuilderApplication>[
  _i1.apply('kiwi:kiwi', [_i2.buildKiwi], _i1.toDependentsOf('kiwi_generator'),
      hideOutput: true, appliesBuilders: ['source_gen:combining_builder']),
  _i1.apply('source_gen:combining_builder', [_i3.combiningBuilder],
      _i1.toNoneByDefault(),
      hideOutput: false, appliesBuilders: ['source_gen:part_cleanup']),
  _i1.apply('jaguar_serializer_cli:jaguar_serializer_cli',
      [_i4.jaguarSerializer], _i1.toRoot(),
      hideOutput: false),
  _i1.applyPostProcess('source_gen:part_cleanup', _i3.partCleanup,
      defaultGenerateFor: const _i5.InputSet())
];
main(List<String> args, [_i6.SendPort sendPort]) async {
  var result = await _i7.run(args, _builders);
  sendPort?.send(result);
  _i8.exitCode = result;
}
mraleph commented 5 years ago

@venkata-ramana what does

D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe ./.dart_tool/build/entrypoint/build.dart build

output?

venkata-ramana commented 5 years ago
[INFO] Generating build script completed, took 438ms
[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot... completed, took 30.5s
[WARNING] Error spawning build script isolate, this is likely due to a Dart SDK update. Deleting snapshot and retrying...
[INFO] Generating build script...

#4      Parser.parseLiteralSymbol (package:front_end/src/fasta/parser/parser.dart:4850:15)
#5      Parser.parsePrimary (package:front_end/src/fasta/parser/parser.dart:4241:14)
#6      Parser.parseUnaryExpression (package:front_end/src/fasta/parser/parser.dart:4172:12)
#7      Parser.parsePrecedenceExpression (package:front_end/src/fasta/parser/parser.dart:3961:13)
#8      Parser.parseExpression (package:front_end/src/fasta/parser/parser.dart:3933:13)
#9      ClassMemberParser.skipExpression (package:front_end/src/fasta/parser/class_member_parser.dart:42:23)
#10     ClassMemberParser.parseExpression (package:front_end/src/fasta/parser/class_member_parser.dart:24:12)
#11     Parser.parseFieldInitializerOpt (package:front_end/src/fasta/parser/parser.dart:2478:15)
#12     Parser.parseFields (package:front_end/src/fasta/parser/parser.dart:2383:13)
#13     Parser.parseTopLevelMemberImpl (package:front_end/src/fasta/parser/parser.dart:2340:12)
#14     Parser.parseTopLevelDeclarationImpl (package:front_end/src/fasta/parser/parser.dart:491:14)
#15     Parser.parseUnit (package:front_end/src/fasta/parser/parser.dart:348:15)
#16     SourceLoader.buildOutline (package:front_end/src/fasta/source/source_loader.dart:271:37)
<asynchronous suspension>
#17     Loader.buildOutlines (package:front_end/src/fasta/loader.dart:198:13)
<asynchronous suspension>
#18     KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:251:20)
<asynchronous suspension>
#19     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
<asynchronous suspension>
#20     KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:249:12)
<asynchronous suspension>
#21     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:110:28)
<asynchronous suspension>
#22     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
<asynchronous suspension>
#23     generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:58:10)
<asynchronous suspension>
#24     generateKernel.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:41:18)
<asynchronous suspension>
#25     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:134:20)
<asynchronous suspension>
#26     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:46)
#27     new Future.sync (dart:async/future.dart:224:31)
#28     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:19)
#29     _rootRun (dart:async/zone.dart:1124:13)
#30     _CustomZone.run (dart:async/zone.dart:1021:19)
#31     _runZoned (dart:async/zone.dart:1516:10)
#32     runZoned (dart:async/zone.dart:1463:12)
#33     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:121:12)
#34     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:132:10)
#35     generateKernel (package:front_end/src/kernel_generator_impl.dart:40:32)
<asynchronous suspension>
#36     kernelForComponent (package:front_end/src/api_prototype/kernel_generator.dart:83:17)
<asynchronous suspension>
#37     SingleShotCompilerWrapper.compileInternal (file:///C:/b/s/w/ir/k/src/third_party/dart/pkg/vm/bin/kernel_service.dart:270:11)
<asynchronous suspension>
#38     Compiler.compile.<anonymous closure> (file:///C:/b/s/w/ir/k/src/third_party/dart/pkg/vm/bin/kernel_service.dart:144:31)
<asynchronous suspension>
#39     new Future.<anonymous closure> (dart:async/future.dart:176:37)
#40     _rootRun (dart:async/zone.dart:1120:38)
#41     _CustomZone.run (dart:async/zone.dart:1021:19)
#42     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#43     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#44     _rootRun (dart:async/zone.dart:1124:13)
#45     _CustomZone.run (dart:async/zone.dart:1021:19)
#46     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#47     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
#48     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#49     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#50     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

#0      ErrorToken.lexeme (package:front_end/src/fasta/scanner/error_token.dart:75:24)
#1      _withArgumentsExpectedIdentifier (package:front_end/src/fasta/fasta_codes_generated.dart:3074:25)
#2      LiteralSymbolIdentifierContext.ensureIdentifier (package:front_end/src/fasta/parser/identifier_context_impl.dart:454:51)
#3      Parser.ensureIdentifier (package:front_end/src/fasta/parser/parser.dart:2161:28)
#4      Parser.parseLiteralSymbol (package:front_end/src/fasta/parser/parser.dart:4850:15)
#5      Parser.parsePrimary (package:front_end/src/fasta/parser/parser.dart:4241:14)
#6      Parser.parseUnaryExpression (package:front_end/src/fasta/parser/parser.dart:4172:12)
#7      Parser.parsePrecedenceExpression (package:front_end/src/fasta/parser/parser.dart:3961:13)
#8      Parser.parseExpression (package:front_end/src/fasta/parser/parser.dart:3933:13)
#9      ClassMemberParser.skipExpression (package:front_end/src/fasta/parser/class_member_parser.dart:42:23)
#10     ClassMemberParser.parseExpression (package:front_end/src/fasta/parser/class_member_parser.dart:24:12)
#11     Parser.parseFieldInitializerOpt (package:front_end/src/fasta/parser/parser.dart:2478:15)
#12     Parser.parseFields (package:front_end/src/fasta/parser/parser.dart:2383:13)
#13     Parser.parseTopLevelMemberImpl (package:front_end/src/fasta/parser/parser.dart:2340:12)
#14     Parser.parseTopLevelDeclarationImpl (package:front_end/src/fasta/parser/parser.dart:491:14)
#15     Parser.parseUnit (package:front_end/src/fasta/parser/parser.dart:348:15)
#16     SourceLoader.buildOutline (package:front_end/src/fasta/source/source_loader.dart:271:37)
<asynchronous suspension>
#17     Loader.buildOutlines (package:front_end/src/fasta/loader.dart:198:13)
<asynchronous suspension>
#18     KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:251:20)
<asynchronous suspension>
#19     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
<asynchronous suspension>
#20     KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:249:12)
<asynchronous suspension>
#21     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:110:28)
<asynchronous suspension>
#22     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
<asynchronous suspension>
#23     generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:58:10)
<asynchronous suspension>
#24     generateKernel.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:41:18)
<asynchronous suspension>
#25     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:134:20)
<asynchronous suspension>
#26     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:46)
#27     new Future.sync (dart:async/future.dart:224:31)
#28     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:122:19)
#29     _rootRun (dart:async/zone.dart:1124:13)
#30     _CustomZone.run (dart:async/zone.dart:1021:19)
#31     _runZoned (dart:async/zone.dart:1516:10)
#32     runZoned (dart:async/zone.dart:1463:12)
#33     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:121:12)
#34     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:132:10)
#35     generateKernel (package:front_end/src/kernel_generator_impl.dart:40:32)
<asynchronous suspension>
#36     kernelForComponent (package:front_end/src/api_prototype/kernel_generator.dart:83:17)
<asynchronous suspension>
#37     SingleShotCompilerWrapper.compileInternal (file:///C:/b/s/w/ir/k/src/third_party/dart/pkg/vm/bin/kernel_service.dart:270:11)
<asynchronous suspension>
#38     Compiler.compile.<anonymous closure> (file:///C:/b/s/w/ir/k/src/third_party/dart/pkg/vm/bin/kernel_service.dart:144:31)
<asynchronous suspension>
#39     new Future.<anonymous closure> (dart:async/future.dart:176:37)
#40     _rootRun (dart:async/zone.dart:1120:38)
#41     _CustomZone.run (dart:async/zone.dart:1021:19)
#42     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#43     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#44     _rootRun (dart:async/zone.dart:1124:13)
#45     _CustomZone.run (dart:async/zone.dart:1021:19)
#46     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#47     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
#48     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#49     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#50     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
mraleph commented 5 years ago

Does it stop abruptly like this? Seems like some lines are missing from the output:

#4      Parser.parseLiteralSymbol (package:front_end/src/fasta/parser/parser.dart:4850:15)
#5      Parser.parsePrimary (package:front_end/src/fasta/parser/parser.dart:4241:14)
#6      Parser.parseUnaryExpression (package:front_end/src/fasta/parser/parser.dart:4172:12)
#7      Parser.parsePrecedenceExpression (package:front_end/src/fasta/parser/parser.dart:3961:13)

Should have #0 ... #3 here.

venkata-ramana commented 5 years ago

Yes it stopped here and #0 to #3 not there

mraleph commented 5 years ago

@jakemac53 I think everything is pointing that build_runner might be generating some code that Fasta can't parse, I just don't understand how is this possible.

My last resort would be to ask if you have tried deleting C:\Users\Venkat\AppData\Roaming\Pub\Cache and then re-running pub get?

venkata-ramana commented 5 years ago

I tried again now and the issue persists. I have no clue why this issue arising.

jakemac53 commented 5 years ago

When it comes to running the generated build script (under .dart_tool) that does import user code so its always possible there is some error there. However I don't see anything concrete in the package analysis (from pub) for these packages, jaguar_serializer_cli has several hints but no errors or warnings.

jakemac53 commented 5 years ago

@venkata-ramana just out of curiosity what if you do pub get and pub run build_runner build?

venkata-ramana commented 5 years ago

removed cached packages, App data, and .dart_tool but could not find a way to make it run. Why it is working if I create a new project. The same codebase producing significant results in other PCs. It seems like a kind of maze for me.

jakemac53 commented 5 years ago

Did you try running the build script directly with these instructions? It doesn't look like that from the command output (that looks like the main build_runner binary output).

D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe ./.dart_tool/build/entrypoint/build.dart build

venkata-ramana commented 5 years ago

It worked, I got the expected result.

venkata-ramana commented 5 years ago

what should I have to do now?

jakemac53 commented 5 years ago

That is really weird. Did you try pub run build_runner build (without flutter packages ...)

venkata-ramana commented 5 years ago

Yes I tried, It is throwing an exception

Unable to spawn isolate: Crash when compiling null, at character offset null: .dart_tool/pub/bin/build_runner/build_runner.dart.snapshot.dart2:182:900: Internal problem: Unhandled AmbiguousBuilder in pushQualifiedReference.�qO╔

jakemac53 commented 5 years ago

This looks like it was caused by the build_runner snapshot again (and not the build script?) but its hard to tell... :/

natebosch commented 5 years ago

From skimming the thread it looks like we tried cleaning the flutter package cache, but maybe not the pub package cache?

Can you paste the contents of your .packages file?

venkata-ramana commented 5 years ago

Generated by pub on 2019-09-09 14:23:43.291331.

analyzer:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.36.0/lib/ args:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/args-1.5.2/lib/ async:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/async-2.2.0/lib/ boolean_selector:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib/ build:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/build-1.1.6/lib/ build_config:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/build_config-0.4.0/lib/ build_daemon:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/build_daemon-2.0.0/lib/ build_resolvers:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/build_resolvers-1.0.7/lib/ build_runner:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/build_runner-1.6.2/lib/ build_runner_core:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/build_runner_core-3.0.9/lib/ built_collection:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/built_collection-4.2.2/lib/ built_value:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/built_value-6.7.0/lib/ cached_network_image:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/cached_network_image-1.1.0/lib/ camera:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/camera-0.5.2+2/lib/ charcode:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/ checked_yaml:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/checked_yaml-1.0.2/lib/ code_builder:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/code_builder-3.2.0/lib/ collection:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/collection-1.14.11/lib/ connectivity:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/connectivity-0.4.3+7/lib/ convert:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/convert-2.1.1/lib/ crypto:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/crypto-2.1.2/lib/ csslib:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/csslib-0.15.0/lib/ cupertino_icons:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/cupertino_icons-0.1.2/lib/ dart_style:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.2.7/lib/ device_info:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/device_info-0.4.0+2/lib/ file_picker:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/file_picker-1.3.8/lib/ firebase_analytics:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/firebase_analytics-4.0.2/lib/ firebase_core:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/firebase_core-0.4.0+8/lib/ fixnum:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fixnum-0.10.9/lib/ flare_dart:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flare_dart-1.4.4/lib/ flare_flutter:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flare_flutter-1.5.5/lib/ fluro:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/fluro-1.5.1/lib/ flutter:file:///D:/Src/flutter-hotfix3/packages/flutter/lib/ flutter_cache_manager:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_cache_manager-1.1.1/lib/ flutter_circular_chart:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_circular_chart-0.1.0/lib/ flutter_image_compress:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_image_compress-0.6.3/lib/ flutter_localizations:file:///D:/Src/flutter-hotfix3/packages/flutter_localizations/lib/ flutter_markdown:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/ flutter_secure_storage:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_secure_storage-3.2.1+1/lib/ flutter_slidable:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_slidable-0.5.3/lib/ flutter_test:file:///D:/Src/flutter-hotfix3/packages/flutter_test/lib/ flutter_webview_plugin:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_webview_plugin-0.3.7/lib/ front_end:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/front_end-0.1.15/lib/ function_types:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/function_types-0.0.2/lib/ geocoder:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/geocoder-0.2.1/lib/ glob:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/glob-1.1.7/lib/ google_maps_flutter:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/google_maps_flutter-0.5.21/lib/ graphs:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/graphs-0.2.0/lib/ html:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html-0.13.4+2/lib/ html2md:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html2md-0.3.1/lib/ http:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http-0.12.0+2/lib/ http_multi_server:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http_multi_server-2.1.0/lib/ http_parser:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib/ image_crop:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/image_crop-0.3.0/lib/ image_picker:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/image_picker-0.6.0+10/lib/ intl:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/intl-0.15.8/lib/ intl_translation:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/intl_translation-0.17.5/lib/ io:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/io-0.3.3/lib/ jaguar_serializer:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/jaguar_serializer-2.2.12/lib/ jaguar_serializer_cli:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/jaguar_serializer_cli-2.2.8/lib/ js:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/js-0.6.1+1/lib/ json_annotation:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/json_annotation-2.4.0/lib/ kernel:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/kernel-0.3.15/lib/ kiwi:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/kiwi-0.2.0/lib/ kiwi_generator:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/kiwi_generator-0.4.0/lib/ lazy_load_scrollview:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/lazy_load_scrollview-1.0.1/lib/ location:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/location-2.3.5/lib/ logging:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib/ markdown:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/markdown-2.0.3/lib/ matcher:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/matcher-0.12.5/lib/ meta:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/meta-1.1.6/lib/ mime:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/mime-0.9.6+3/lib/ open_file:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/open_file-2.0.3/lib/ package_config:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/package_config-1.1.0/lib/ package_info:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/package_info-0.4.0+6/lib/ package_resolver:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/package_resolver-1.0.10/lib/ page_transition:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/page_transition-1.1.4/lib/ path:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/path-1.6.2/lib/ path_provider:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/path_provider-1.2.0/lib/ pedantic:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pedantic-1.7.0/lib/ permission_handler:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/permission_handler-3.2.1+1/lib/ petitparser:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/petitparser-2.4.0/lib/ pool:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pool-1.4.0/lib/ progress_indicators:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/progress_indicators-0.1.2/lib/ pub_semver:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib/ pubspec_parse:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pubspec_parse-0.1.5/lib/ queries:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/queries-0.1.12/lib/ quiver:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/quiver-2.0.3/lib/ scoped_model:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/scoped_model-1.0.1/lib/ sentry:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/sentry-2.2.0/lib/ shared_preferences:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shared_preferences-0.5.3+4/lib/ shelf:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf-0.7.5/lib/ shelf_web_socket:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.3/lib/ sky_engine:file:///D:/Src/flutter-hotfix3/bin/cache/pkg/sky_engine/lib/ source_gen:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_gen-0.9.4+4/lib/ source_span:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_span-1.5.5/lib/ sqflite:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/sqflite-1.1.6+2/lib/ stack_trace:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib/ stream_channel:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stream_channel-2.0.0/lib/ stream_transform:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stream_transform-0.0.19/lib/ string_scanner:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib/ synchronized:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/synchronized-2.1.0+1/lib/ term_glyph:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/ test_api:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test_api-0.2.5/lib/ timing:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/timing-0.1.1+2/lib/ typed_data:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib/ url_launcher:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/url_launcher-5.1.2/lib/ usage:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/usage-3.4.1/lib/ utf:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib/ uuid:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/uuid-2.0.2/lib/ vector_math:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/ watcher:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/watcher-0.9.7+12/lib/ web_socket_channel:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/web_socket_channel-1.0.15/lib/ yaml:file:///C:/Users/Venkat/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/yaml-2.1.16/lib/ keka:lib/

natebosch commented 5 years ago

Yeah, this looks like you're using the pub cache and might have something corrupt in there. Can you try deleting the directory C:/Users/Venkat/AppData/Roaming/Pub/Cache/ and then pub get again?

venkata-ramana commented 5 years ago

No luck, Still getting the same error

keshava19 commented 5 years ago

@venkata-ramana can you post output of these two commands:

> D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe --version
> D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe .dart_tool\pub\bin\bin\build_runner\build_runner.dart.snapshot.dart2

Note: you would need to execute the second command in your project folder (where it previously failed).

If the second command fails also try:

> D:\src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe C:\Users\Venkat\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\build_runner-1.6.2\bin\build_runner.dart

For me both the first and second command worked.

C:\src\flutter\bin\cache\dart-sdk\bin>dart.exe --version
Dart VM version: 2.5.0 (Fri Sep 6 20:10:36 2019 +0200) on "windows_x64"
C:\Users\keshava.v\Documents\Projects\Mobile%20First\keka> C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe .dart_tool\pub\bin\build_runner\build_runner.dart.snapshot.dart2
Unified interface for running Dart builds.

Usage: build_runner <command> [arguments]

Global options:
-h, --help    Print this usage information.

Available commands:
  build   Performs a single build on the specified targets and then exits.
  clean   Cleans up output from previous builds. Does not clean up --output directories.
  help    Display help information for build_runner.
  run     Performs a single build, and executes a Dart script with the given arguments.
  serve   Runs a development server that serves the specified targets and runs builds based on file system updates.
  test    Performs a single build of the test directory only and then runs tests using the compiled assets.
  watch   Builds the specified targets, watching the file system for updates and rebuilding as appropriate.

Run "build_runner help <command>" for more information about a command.
C:\Users\keshava.v\Documents\Projects\Mobile%20First\keka> C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe .dart_tool\pub\bin\build_runner\build_runner.dart.snapshot.dart2 build
[INFO] Generating build script completed, took 452ms
[INFO] Creating build script snapshot... completed, took 19.7s
^C

The last command was running forever so had to stop it.

keshava19 commented 5 years ago

@venkata-ramana what does

D:\Src\flutter-hotfix3\bin\cache\dart-sdk\bin\dart.exe ./.dart_tool/build/entrypoint/build.dart build

output?

This command ran for me, and the output is below.

C:\Users\keshava.v\Documents\Projects\Mobile%20First\keka>C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe ./.dart_tool/build/entrypoint/build.dart build
[INFO] Building new asset graph completed, took 2.1s
[INFO] Found 123 declared outputs which already exist on disk. This is likely because the`.dart_tool/build` folder was deleted, or you are submitting generated files to your source repository.
Delete these files?
1 - Delete
2 - Cancel build
3 - List conflicts
1
[INFO] Checking for unexpected pre-existing outputs. completed, took 29.9s
[INFO] Generating SDK summary completed, took 5.9s
[INFO] Running build completed, took 1m 27s
[INFO] Caching finalized dependency graph completed, took 422ms
[INFO] Succeeded after 1m 28s with 125 outputs (2009 actions)
nydlmaster commented 4 years ago

Just had a similar issue. In my case there was a type in one of the imports.I had "F" instead of "f" in one if the import files. Just double check all the imports (cases, spaces, underscores, etc) thoroughly .

johnniwinther commented 4 years ago

The underlying issue for the original crash was fixed in https://dart-review.googlesource.com/c/sdk/+/113183.

@nydlmaster Can you provide a stack trace for the issue you are seeing?