appsmithorg/appsmith · error · Error

You specified ${type} in your env, but the file "${file}" ca

Error message

You specified ${type} in your env, but the file "${file}" can't be found.

What it means

Thrown by readEnvFile() in getHttpsConfig.js. After the caller resolves SSL_CRT_FILE / SSL_KEY_FILE from the environment, readEnvFile() checks fs.existsSync(file); if the path does not resolve to a real file it throws, naming the env var type and the missing path. This is the file-resolution gate before the cert/key content is ever parsed.

Source

Thrown at app/client/config/getHttpsConfig.js:37

    );
  }

  try {
    // privateDecrypt will throw an error with an invalid key
    crypto.privateDecrypt(key, encrypted);
  } catch (err) {
    throw new Error(
      `The certificate key "${chalk.yellow(keyFile)}" is invalid.\n${
        err.message
      }`
    );
  }
}

// Read file and throw an error if it doesn't exist
function readEnvFile(file, type) {
  if (!fs.existsSync(file)) {
    throw new Error(
      `You specified ${chalk.cyan(
        type
      )} in your env, but the file "${chalk.yellow(file)}" can't be found.`
    );
  }
  return fs.readFileSync(file);
}

// Get the https config
// Return cert files if provided in env, otherwise just true or false
function getHttpsConfig() {
  const { SSL_CRT_FILE, SSL_KEY_FILE, HTTPS } = process.env;
  const isHttps = HTTPS === 'true';

  if (isHttps && SSL_CRT_FILE && SSL_KEY_FILE) {
    const crtFile = path.resolve(paths.appPath, SSL_CRT_FILE);
    const keyFile = path.resolve(paths.appPath, SSL_KEY_FILE);
    const config = {

View on GitHub (pinned to 8cd9021c24)

Solutions

  1. Confirm the file exists at exactly the resolved path: 'ls -l "$SSL_CRT_FILE" "$SSL_KEY_FILE"'.
  2. Use absolute paths in SSL_CRT_FILE / SSL_KEY_FILE rather than '~' or relative paths.
  3. In Docker, verify the bind-mount/copy lands the file at the configured path inside the container.
  4. Check for case mismatches and trailing whitespace in the env var value.

Example fix

# before
SSL_CRT_FILE=~/certs/cert.pem  # '~' not expanded by node
# -> You specified SSL_CRT_FILE in your env, but the file "~/certs/cert.pem" can't be found.

# after
SSL_CRT_FILE=/home/me/certs/cert.pem SSL_KEY_FILE=/home/me/certs/key.pem HTTPS=true npm start
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
const { SSL_CRT_FILE, SSL_KEY_FILE } = process.env;
for (const f of [SSL_CRT_FILE, SSL_KEY_FILE].filter(Boolean)) {
  if (!fs.existsSync(f)) throw new Error(`HTTPS file not found: ${f}`);
}

Try / catch

try { getHttpsConfig(); } catch (e) {
  if (/can't be found/i.test(e.message)) { /* fix path */ }
  else throw e;
}

Prevention

When it happens

Trigger: HTTPS=true with SSL_CRT_FILE or SSL_KEY_FILE set to a path that does not exist on disk: a typo, a relative path resolved against the wrong cwd, a Docker bind-mount that did not mount the file, or a path from a different machine.

Common situations: Path with a leading '~/` that is not expanded; Docker volume mounted to the wrong container path; file created on host but not copied into the image; case-sensitivity mismatch on Linux vs macOS/Windows; env var pointing at a file deleted by a clean step.

Related errors


AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12). Data as JSON: /api/errors/9a01be005bfc37c5. Report an issue: GitHub.