Skip to content

[Bug]: Trailing newlines in multiline environment variables are getting removed #9438

@Encotric

Description

@Encotric

Error Message and Logs

2026-Apr-05 16:54:32.922817
#27 1.875 warning: spurious network error (2 tries remaining): process didn't exit successfully: `git fetch --tags --force --update-head-ok 'ssh://<REDACTED>.git' '+refs/heads/*:refs/remotes/origin/*' '+HEAD:refs/remotes/origin/HEAD'` (exit status: 128)
2026-Apr-05 16:54:36.200954
#27 5.479 Load key "/root/.ssh/id_ed25519": error in libcrypto

Steps to Reproduce

  1. Create an application
  2. Enable Use Docker Build Secrets for env vars
  3. Add a multiline env var, e.g., SSH private key for build time
  4. Use the secret in a Dockerfile: RUN --mount=type=secret,id=SSH_KEY,target=/root/.ssh/id_ed25519 <COMMAND>

Example Repository URL

No response

Coolify Version

v4.0.0-beta.470

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Debian 13

Additional Information

It seems like Coolify removes trailing newlines from multiline environment variables (such as SSH private keys). This causes git to fail reading the private key when I try to import it as a build secret in my Dockerfile.

Maybe it would be a good idea to add an option to disable the removal of trailing whitespace and newlines in such cases? Unfortunately, using literal values and \n in my private key variable did not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔍 TriageIssues that need assessment and prioritization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions