mirror of
https://github.com/koel/koel.git
synced 2026-04-25 08:46:00 +03:00
[GH-ISSUE #2054] [Bug]: Encountering "Uncaught ErrorException: Cannot modify header information - headers already sent" #1084
Labels
No labels
Authentication
Dependencies
Documentation
Feature Request
Flac
Help Wanted
Installation/Setup
Integration
Mobile
PR Welcome
Pending Release
Performance
Playlist
S3
Search
Sync
[Pri] Low
[Pri] Normal
[Status] Keep Open
[Status] Needs Author Reply
[Status] Needs Review
[Status] Stale
[Status] Will Implement
[Type] Blessed
[Type] Bug
[Type] Duplicate
[Type] Enhancement
[Type] Help Request
[Type] Question
[Type] Task
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/koel-koel#1084
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lewislarsen on GitHub (Aug 17, 2025).
Original GitHub issue: https://github.com/koel/koel/issues/2054
Originally assigned to: @phanan on GitHub.
Read the Troubleshooting guide.
Reproduction steps
php artisan koel:init --no-assetsphp artisan koel:scanExpected behavior
The music to begin playing.
Actual behavior
The music did not play and an error presented in both the Browser Console and the Laravel logs.
Logs
Console:
Laravel Logs:
Koel version
Koel v7.12.0 Community Edition
How did you install Koel?
Official Docker image
Additional information
I have configured
FORCE_HTTPS=trueas it was needed due to the subdomain having SSL.The issue still happens even if I disable my reverse proxy, turn off FORCE_HTTPS and navigate to Koel with the IP and port combination.
When visiting the link (/play/blah-blah-blah etc) present in the browser console, I download an m4a that seems to play fine locally so I don't think it's an issue with how Koel is handling my FLAC files.
@lewislarsen commented on GitHub (Aug 17, 2025):
Update two:
I just switched my Koel instance to use
x-accel-redirectmethod and the PHP error I mentioned no longer appears in the Laravel log. Admittedly I'm still not sure as to the cause of the initial playing issues when the app was Dockerized, but I think this bare metal solution works fine.Closing for now.
A little update:
I tried running Koel by pulling down the "master" branch and putting it on the box (where many other Laravel apps reside!) and it worked first try with one caveat: the header error kept appearing in the logs in the bare metal instance too.
The music is playing on the bare metal instance completely fine, with none of the PARTIAL_TRANSFER errors found when trying to play music on the Dockerized app. Both apps are pulling music from the same folder.
@lewislarsen commented on GitHub (Aug 22, 2025):
Hi there.
Unfortunately, I have to reopen this as the problem noted in the original issue has appeared in my bare-metal deployment of Koel.
The only change recently has been a recent deployment of code from the master branch, and the subsequent running of
php artisan koel:initin the deployment script. Seeing the code that was pushed to the branch I doubt it's related in any way.It does seem like the Laravel logs and the error in browser are related as they've both appeared.
Logs:
Browser:
This error presents itself in both on web and via the mobile app, however the song is able to play to completion on the mobile app. On Firefox no audio is played.
I'm not too sure if my nginx site config file will be useful here, but as I'm using
x-accel-redirectit seemed like a good idea to include. I've redacted the subdomain itself.Here are the nginx errors logs, much of the same from the Laravel log really.
If you need any specific or additional information about my configuration, please do let me know. I do apologize for the length of this reply but I hope it might be useful in potentially discovering what's going awry.
@lewislarsen commented on GitHub (Aug 22, 2025):
Hey @phanan I have some bad news.
Thank you so much for your commit, but unfortunately there's been no change and this problem still persists. The instance is using the latest deployment of the master branch, commit 3825034b8b.
Even if
phporx-accel-redirectis specified in the.env, this issue still happens.Firefox, Chrome or Safari all produce the same problem.
I'm not really sure what's the specific issue with my environment that's causing this, but I'll try to list everything I can that I can think of.
Server Configuration
Nginx: 1.28.0
PHP: 8.4.11
OS: Ubuntu 24.04.3 LTS
Postgres: (PostgreSQL) 17.6 (Ubuntu 17.6-1.pgdg24.04+1)
Redis: Redis server v=7.0.15
Node: v20.19.4
Application Version: Koel v7.12.0 Community Edition (Commit
3825034b8bfrom /koel/koel master branch)The application is deployed via Ploi but it only provides an interface, it doesn't manage or make extraordinary changes.
Here is the output of
php artisan koel:doctorFor what it's worth, the Spotify error is
[KOEL.DOCTOR] Class "Faker\Factory" not foundas per the logs, but this existed whilst the bare metal instance was functioning and able to play music via web browsers.@phanan commented on GitHub (Aug 22, 2025):
DefaultOutputWriteris only used for PHP native streaming, so I've no idea why it would yield any issue forx-accel-redirect. If any, it suggests some problem with your system. For example, I notice that you're using PHP 8.4, which can be quite noisy about deprecations — maybe try to disable them.@phanan commented on GitHub (Aug 22, 2025):
Actually, what you said:
makes perfect sense and is aligned with the issue found (and fixed): For PHP streaming method, the song data was sent by
DefaultOutputWriterand (due to a bug) Laravel/Symfony tried to send more headers, which broke. This should NOT happen withx-accel-redirectsimply because this method doesn't involveDefaultOutputWriterat all.So, if you're saying the same issue happens for
x-accel-redirect, I've no idea why. Please check if it's indeed the same issue.