Format string uses a conversion character that does not exist

ID

scala.correctness.malformed_format_string

Severity

low

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Api Misuse

Language

Scala

Description

This format string contains a conversion that the formatter does not define, so the call throws UnknownFormatConversionException at run time rather than failing to compile. Use one of the documented conversions (%s, %d, %f, %x, …​), and escape a literal percent sign as %%.

Rationale

This format string contains a conversion that the formatter does not define, so the call throws UnknownFormatConversionException at run time rather than failing to compile. Use one of the documented conversions (%s, %d, %f, %x, …​), and escape a literal percent sign as %%.

The following code illustrates the pattern detected by this rule:

class MalformedFormatString {
  def greet(name: String): String = {
    // FLAGGED: Format string uses a conversion character that does not exist
    "hello %z".format(name)
  }
}

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved