{"record":{"id":"a69f9573d716728b","repo":"zxing/zxing","slug":"requested-dimensions-are-too-small-width-x-hei","errorCode":null,"errorMessage":"Requested dimensions are too small: ${width}x${height}","messagePattern":"Requested dimensions are too small: (.+?)x(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java","lineNumber":63,"sourceCode":"  }\n\n  @Override\n  public BitMatrix encode(String contents,\n                          BarcodeFormat format,\n                          int width,\n                          int height,\n                          Map<EncodeHintType,?> hints) throws WriterException {\n\n    if (contents.isEmpty()) {\n      throw new IllegalArgumentException(\"Found empty contents\");\n    }\n\n    if (format != BarcodeFormat.QR_CODE) {\n      throw new IllegalArgumentException(\"Can only encode QR_CODE, but got \" + format);\n    }\n\n    if (width < 0 || height < 0) {\n      throw new IllegalArgumentException(\"Requested dimensions are too small: \" + width + 'x' +\n          height);\n    }\n\n    ErrorCorrectionLevel errorCorrectionLevel = ErrorCorrectionLevel.L;\n    int quietZone = QUIET_ZONE_SIZE;\n    if (hints != null) {\n      if (hints.containsKey(EncodeHintType.ERROR_CORRECTION)) {\n        errorCorrectionLevel = ErrorCorrectionLevel.valueOf(hints.get(EncodeHintType.ERROR_CORRECTION).toString());\n      }\n      if (hints.containsKey(EncodeHintType.MARGIN)) {\n        quietZone = Integer.parseInt(hints.get(EncodeHintType.MARGIN).toString());\n      }\n    }\n\n    QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);\n    return renderResult(code, width, height, quietZone);\n  }\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/zxing/zxing/blob/19aa2d8254410e161f04dc3c928e68d5e90233c2/core/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java#L45-L81","documentation":"Error \"Requested dimensions are too small: ${width}x${height}\" thrown in zxing/zxing.","triggerScenarios":"Thrown at core/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Request output dimensions large enough to contain the QR symbol including quiet zone.","Pass 0x0 (or omit dimensions) to let the writer pick a suitable size."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"19aa2d8254410e161f04dc3c928e68d5e90233c2","analyzedAt":"2026-08-14T03:07:53.428Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}