{"record":{"id":"973a14eff976849b","repo":"opf/openproject","slug":"configuration-value-for-environment-variable-en","errorCode":null,"errorMessage":"Configuration value for environment variable '#{env_var_name}' is invalid: #{e.message}","messagePattern":"Configuration value for environment variable '#(.+?)' is invalid: #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"critical","filePath":"config/constants/settings/definition.rb","lineNumber":1875,"sourceCode":"      #\n      # @param env_var_name [String] The environment variable name.\n      # @param env_var_value [String] The string from which to extract the actual value.\n      # @return A ruby object (e.g. Integer, Float, String, Hash, Boolean, etc.)\n      # @raise [ArgumentError] If the string could not be parsed.\n      def extract_value_from_env(env_var_name, env_var_value)\n        # YAML parses '' as false, but empty ENV variables will be passed as that.\n        # To specify specific values, one can use !!str (-> '') or !!null (-> nil)\n        return env_var_value if env_var_value == \"\"\n\n        parsed = load_yaml(env_var_value)\n\n        if parsed.is_a?(String)\n          env_var_value\n        else\n          parsed\n        end\n      rescue StandardError => e\n        raise ArgumentError, \"Configuration value for environment variable '#{env_var_name}' is invalid: #{e.message}\"\n      end\n\n      def load_yaml(source)\n        YAML::safe_load(source, permitted_classes: [Symbol, Date])\n      end\n    end\n\n    private\n\n    attr_accessor :serialized,\n                  :writable\n\n    def value_override?\n      !resolve_value_override.nil?\n    end\n\n    def resolve_value_override\n      self.class.value_overrides[name.to_sym]&.each do |block|","sourceCodeStart":1857,"sourceCodeEnd":1893,"githubUrl":"https://github.com/opf/openproject/blob/d9742c43f3424c34b63550f8c03f201fe5c3040c/config/constants/settings/definition.rb#L1857-L1893","documentation":"Every OPENPROJECT_* environment override is parsed with YAML.safe_load (permitted classes: Symbol and Date) by Settings::Definition.extract_value_from_env so that typed values (integers, booleans, arrays, hashes) can be expressed in env vars. Any StandardError — typically Psych::SyntaxError from malformed YAML or Psych::DisallowedClass from an unpermitted tag — is wrapped in ArgumentError naming the env var and the underlying parser message. It is raised when the setting override is resolved, effectively at startup.","triggerScenarios":"An OPENPROJECT_* value that is invalid YAML or instantiates a disallowed class: an unquoted scalar containing ': ' such as OPENPROJECT_APP__TITLE=Hello: World (Psych::SyntaxError: mapping values are not allowed in this context), unbalanced quotes/brackets, undefined YAML aliases (*ref), or explicit tags like !ruby/object. Note: an empty string is passed through verbatim; !!str '' yields a literal empty string and !!null yields nil.","commonSituations":"docker-compose/Kubernetes env values containing colons, asterisks or brackets without quoting; values copy-pasted from YAML files losing their quotes; prose/URL-with-colon values set as bare scalars; secrets or multi-line values injected with characters YAML treats specially.","solutions":["Quote values containing YAML metacharacters: OPENPROJECT_APP__TITLE='\"Hello: World\"'","Use valid YAML for typed values: arrays as \"[a, b]\", hashes as \"{a: b}\", booleans as true/false, numbers bare","Remember the special cases: '' passes through as the raw string, !!str '' gives a literal empty string, !!null gives nil","Re-run startup after fixing — the error names the exact env var and includes the parser's reason"],"exampleFix":"# before — boot fails with\n#   ArgumentError: Configuration value for environment variable 'OPENPROJECT_APP__TITLE' is invalid:\n#   mapping values are not allowed in this context\nenvironment:\n  OPENPROJECT_APP__TITLE: \"Hello: World\"\n\n# after\nenvironment:\n  OPENPROJECT_APP__TITLE: \"'Hello: World'\"   # or quote inside the value: \"'Hello: World'\"","handlingStrategy":"validation","validationCode":"# CI/deploy check: parse every OPENPROJECT_* override with the same YAML rules\nrequire \"yaml\"\nENV.grep(/\\AOPENPROJECT_/).each do |key|\n  value = ENV.fetch(key)\n  next if value == \"\" # passed through verbatim by the app\n  YAML.safe_load(value, permitted_classes: [Symbol, Date])\nrescue StandardError => e\n  abort \"Invalid #{key}: #{e.message}\"\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote any env value containing ': ', '*', '[', '{', or quotes — YAML metacharacters","Run the safe_load check above in CI with the production env file so failures surface before deploy","Learn the three special forms: '' stays raw, !!str '' is an explicit empty string, !!null is nil"],"tags":["configuration","yaml","environment-variables","boot","settings"],"backgroundTag":"invalid-yaml-config","analyzedSha":"d9742c43f3424c34b63550f8c03f201fe5c3040c","analyzedAt":"2026-08-21T14:40:06.829Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}