Skip to content

record create: Integer overflow gives misleading 'Incorrect attribute value type' error #83

Description

@TomProkop

Description

When creating a record with an integer value that exceeds Int32.MaxValue (2,147,483,647) for a WholeNumber column, the CLI returns a misleading error message about type mismatch instead of explaining the value is out of range.

Steps to Reproduce

txc env data record create --entity txcv3_valv3rt1434 \
  --data '{"txcv3_name":"Test","txcv3_wholenumplain":3000000000}' \
  --apply --allow-production

Expected Behavior

A clear error message indicating the value exceeds the Int32 range:

Validation error: value 3000000000 exceeds WholeNumber range (-2147483648 to 2147483647)

Actual Behavior

Incorrect attribute value type System.Int64

This is technically accurate (JSON parses 3B as Int64 since it exceeds Int32), but unhelpful — the developer needs to know the value is too large, not that the type is wrong.

Comparison

Other numeric types give clear range messages:

  • Decimal: "value 999999999999.0 is outside the valid range(-100000000000 to 100000000000)"
  • Money: "value 999999999999999.0 is outside the valid range(-922337203685477 to 922337203685477)"
  • Duration: "value -100 is outside the valid range. Minimum Value: 0, Maximum value: 2147483647"

Impact

🟢 Low — The operation correctly fails, but the error message creates confusion.

Suggested Fix

When an Int64 value is passed for an Int32 column, check if the value exceeds Int32 range and provide a range validation error instead of a type mismatch error.


Found during PR #67 (pp-entity-attribute) CRUD validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions