anchor.diff:    );
     final result = await element.session.getResolvedLibraryByElement(library);
     if (result.state == ResultState.NOT_A_FILE) {
  -    // We don't have access to source information in summarized libraries,
  -    // but another build step will likely emit the root cause errors.
  -    throw BuildError.withoutContext(
  -      'Analysis errors in summarized library '
  -      '${library.source.fullName}',
  -    );
  +    _throwInvalidSummaryError(library.source.fullName);
     }
     return result.getElementDeclaration(element);
  +}
  +
  +void _throwInvalidSummaryError(String summaryName) {
  +  // We don't have access to source information in summarized libraries,
  +  // but another build step will likely emit the root cause errors.
  +  throw BuildError.withoutContext(
  +    'Errors in summarized library $summaryName',
  +  );
   }
   
   abstract class AsyncBuildError {
  
positive.code: 
      ElementDeclarationResult result;
      try {
        result = await _resolvedClassResult(
          resolver,
          indexedAnnotation.element,
          toString(),
        );
      } on BuildError catch (buildError) {
        final annotationSource = indexedAnnotation.annotation.toSource();
        return BuildError.withoutContext('$buildError\n\n'
            'This error occurred processing the following annotation:\n'
            '$annotationSource');
      }
  
      var resolvedMetadata = _metadataFromAncestry(result.node);
  
negative.code: 
  Future<ElementDeclarationResult> _resolvedClassResult(
    Resolver resolver,
    Element element,
  ) async {
    AssetId assetId;
    try {
      assetId = await resolver.assetIdForElement(element);
    } on UnresolvableAssetException catch (_) {
      _throwInvalidSummaryError(element.source.fullName);
    }
    // A `part of` dart file is not a standalone dart library. Thus,
    // [library] is null when an error occurs in a `part of` dart file.
  