# CLI Import Command bricht ab: supplied resource is not a valid stream resource

**URL:** <https://forum.shopware.com/t/cli-import-command-bricht-ab-supplied-resource-is-not-a-valid-stream-resource/95873>\
**Category:** Programmierung\
**Tags:** programming\
**Created:** [19. August 2022 um 11:49 UTC](https://forum.shopware.com/t/cli-import-command-bricht-ab-supplied-resource-is-not-a-valid-stream-resource/95873 "2022-08-19T11:49:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vs-itservices](https://avatars.discourse-cdn.com/v4/letter/v/7ea924/32.png) [@vs-itservices](https://forum.shopware.com/u/vs-itservices)\
**Post date:** [19. August 2022 um 11:49 UTC](https://forum.shopware.com/t/cli-import-command-bricht-ab-supplied-resource-is-not-a-valid-stream-resource/95873/1 "2022-08-19T11:49:24Z")

</div>

Hallo,

wenn per Console ein Entity Import ausgeführt wird, dann bricht der Import nach 500 bis 1000 Zeilen ab.

```auto
Starting import of size 56845 
==============================

 28442/56845 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░] 50%10:42:01 CRITICAL [console] Error thrown while running command "import:entity 'PriceList.csv' 2022-09-01 UpdatePriceList". Message: "stream_copy_to_stream(): supplied resource is not a valid stream resource" ["exception" => TypeError { …},"command" => "import:entity 'PriceList.csv' 2022-09-01 UpdatePriceList","message" => "stream_copy_to_stream(): supplied resource is not a valid stream resource"]

In AbstractFileWriter.php line 41:
                                                                             
  stream_copy_to_stream(): supplied resource is not a valid stream resource  
                                                                       

```

Der Import wurde so gestartet:  
`bin/console import:entity PriceList.csv 2022-09-01 UpdatePriceList`

Wenn der Import über die UI ausgeführt wird, dann läuft der Import sauber durch. Auch mehrere Importe parallel.

Sind für CLI eventuell bestimmte PHP Einstellungen zu beachten?

Beste Grüße

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [20. August 2022 um 12:53 UTC](https://forum.shopware.com/t/cli-import-command-bricht-ab-supplied-resource-is-not-a-valid-stream-resource/95873/2 "2022-08-20T12:53:19Z")

</div>

Die CLI verwendet in der Regel andere PHP-Einstellung, ist ggf. sogar eine andere Version. Mal in den Einstellungen schauen, vielleicht liegt es ja am zugeteilten Speicher oder Laufzeit.

---

<div class="post-metadata">

**Author:** ![vs-itservices](https://avatars.discourse-cdn.com/v4/letter/v/7ea924/32.png) [@vs-itservices](https://forum.shopware.com/u/vs-itservices)\
**Post date:** [23. August 2022 um 09:29 UTC](https://forum.shopware.com/t/cli-import-command-bricht-ab-supplied-resource-is-not-a-valid-stream-resource/95873/3 "2022-08-23T09:29:42Z")

</div>

Die Einstellungen für CLI sind teilweise „hardcoded“ festgelegt.

```auto
max_execution_time => 0 => 0
max_input_time => -1 => -1
output_buffering => 0 => 0

```

Mir ist aufgefallen das `implicit_flush => On => On` im CLI SAPI Modus immer aktiv ist.

```auto
; Note: This directive is hardcoded to On for the CLI SAPI

```

In der Webserver Konfiguration ist diese Einstellung deaktiviert.

---

<div class="post-metadata">

**Author:** ![vs-itservices](https://avatars.discourse-cdn.com/v4/letter/v/7ea924/32.png) [@vs-itservices](https://forum.shopware.com/u/vs-itservices)\
**Post date:** [7. September 2022 um 14:48 UTC](https://forum.shopware.com/t/cli-import-command-bricht-ab-supplied-resource-is-not-a-valid-stream-resource/95873/4 "2022-09-07T14:48:09Z")

</div>

Der Fehler trifft auf wenn für das filesystem private Amazon S3 eingerichtet ist.

 ![Bildschirmfoto 2022-09-07 um 14.36.53](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/4/a/4af6b8575f4bfa4a6eb6094935559d5acb61123e.png)

Wird das private filesystem lokal abgelegt dann läuft der Import ohne Fehler durch.

Jedoch dauert ein Update der Erweiterten Preise von 15000 Artikel drei bis vier Stunden.

Hat jemand eine Idee wie die Performance verbessert werden kann?
