dart-lang / pub

The pub command line tool
https://dart.dev/tools/pub/cmd
BSD 3-Clause "New" or "Revised" License
1.04k stars 229 forks source link

{"error":{"message":"RangeError (index): Index out of range: no indices are valid: 0"}} #3034

Closed WangZhen0908 closed 2 years ago

WangZhen0908 commented 3 years ago

Environment

pub version or flutter pub version: Pub 2.7.0 flutter: OS version: CentOS-7-x86_64-Everything-2009 Are you using the Chinese community mirror or a corporate firewall? yes

Problem

when exec flutter packages pub publish --server=http://192.168.70.128

Error in Client

{"error":{"message":"RangeError (index): Index out of range: no indices are valid: 0"}}

Error in server

`#0 _Uint8ArrayView.[] (dart:typed_data-patch/typed_data_patch.dart:3779:7)

1 InputStream.readUint16 (package:archive/src/util/input_stream.dart:206:22)

2 GZipDecoder._readHeader (package:archive/src/gzip_decoder.dart:89:29)

3 GZipDecoder.decodeBuffer (package:archive/src/gzip_decoder.dart:26:5)

4 GZipDecoder.decodeBytes (package:archive/src/gzip_decoder.dart:17:12)

5 FileRepository.upload (file:///home/wangzhen/dev/pub_server/example/src/examples/file_repository.dart:67:34)

#6 CopyAndWriteRepository.upload (file:///home/wangzhen/dev/pub_server/example/src/examples/cow_repository.dart:104:36) #7 ShelfPubServer._uploadSimple (package:pub_server/shelf_pubserver.dart:389:38) #8 ShelfPubServer.requestHandler (package:pub_server/shelf_pubserver.dart:202:16) #9 logRequests... (package:shelf/src/middleware/logger.dart:30:46) #10 new Future.sync (dart:async/future.dart:224:31) #11 logRequests.. (package:shelf/src/middleware/logger.dart:30:23) #12 handleRequest (package:shelf/shelf_io.dart:101:29) #13 serveRequests.. (package:shelf/shelf_io.dart:63:34) #14 _rootRunUnary (dart:async/zone.dart:1134:38) #15 _CustomZone.runUnary (dart:async/zone.dart:1031:19) #16 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7) #17 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:338:11) #18 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:265:7) #19 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:766:19) #20 _StreamController._add (dart:async/stream_controller.dart:642:7) #21 _StreamController.add (dart:async/stream_controller.dart:588:5) #22 _HttpServer._handleRequest (dart:_http/http_impl.dart:2828:19) #23 new _HttpConnection. (dart:_http/http_impl.dart:2586:19) #24 _rootRunUnary (dart:async/zone.dart:1134:38) #25 _CustomZone.runUnary (dart:async/zone.dart:1031:19) #26 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7) #27 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:338:11) #28 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:265:7) #29 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:766:19) #30 _StreamController._add (dart:async/stream_controller.dart:642:7) #31 _StreamController.add (dart:async/stream_controller.dart:588:5) #32 _HttpParser._headersEnd (dart:_http/http_parser.dart:388:17) #33 _HttpParser._doParse (dart:_http/http_parser.dart:703:15) #34 _HttpParser._parse (dart:_http/http_parser.dart:320:7) #35 _HttpParser._onData (dart:_http/http_parser.dart:812:5) #36 _rootRunUnary (dart:async/zone.dart:1134:38) #37 _CustomZone.runUnary (dart:async/zone.dart:1031:19) #38 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7) #39 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:338:11) #40 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:265:7) #41 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:766:19) #42 _StreamController._add (dart:async/stream_controller.dart:642:7) #43 _StreamController.add (dart:async/stream_controller.dart:588:5) #44 _Socket._onData (dart:io-patch/socket_patch.dart:1831:41) #45 _rootRunUnary (dart:async/zone.dart:1138:13) #46 _CustomZone.runUnary (dart:async/zone.dart:1031:19) #47 _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7) #48 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:338:11) #49 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:265:7) #50 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:766:19) #51 _StreamController._add (dart:async/stream_controller.dart:642:7) #52 _StreamController.add (dart:async/stream_controller.dart:588:5) #53 new _RawSocket. (dart:io-patch/socket_patch.dart:1379:33) #54 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:899:14) #55 _microtaskLoop (dart:async/schedule_microtask.dart:43:21) #56 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5) #57 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13) #58 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5) 2021-06-18T14:35:52.106984 0:00:00.001049 POST [302] /api/packages/versions/newUpload 2021-06-18 14:35:52.131507 INFO pubserver.shelf_pubserver Finish simple upload (error: RangeError (index): Index out of range: no indices are valid: 0). 2021-06-18T14:35:52.131426 0:00:00.000307 GET [400] /api/packages/versions/newUploadFinish?error=RangeError%20(index)%3A%20Index%20out%20of%20range%3A%20no%20indices%20are%20valid%3A%200` but in ubuntu-20.04.2.0-desktop-amd64 everything is ok
sigurdm commented 3 years ago

It seems you are trying to use https://pub.dev/packages/pub_server . It has been discontinued and is not supported.