apache/pulsar · error · TypeConversionException

e.getMessage()

Error message

e.getMessage()

What it means

ByteUnitToLongConverter.convert wraps the size-validation error into picocli's TypeConversionException, forwarding the original IllegalArgumentException message (e.getMessage()) for an invalid byte-size argument.

Source

Thrown at pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/converters/picocli/ByteUnitToLongConverter.java:31

 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.pulsar.cli.converters.picocli;

import static org.apache.pulsar.cli.converters.ByteUnitUtil.validateSizeString;
import picocli.CommandLine.ITypeConverter;
import picocli.CommandLine.TypeConversionException;

public class ByteUnitToLongConverter implements ITypeConverter<Long> {
    @Override
    public Long convert(String value) throws Exception {
        try {
            return validateSizeString(value);
        } catch (Exception e) {
            throw new TypeConversionException(e.getMessage());
        }
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Fix the size argument format per the converter message
  2. Use plain numbers or K/M/G/T suffixes
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pulsar-cli-utils/src/main/java/org/apache/pulsar/cli/converters/picocli/ByteUnitToLongConverter.java:31 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/e0dd4d47576c710f. Report an issue: GitHub.