Skip to content

Add error message for invalid event data names#22

Open
s3n-w6i wants to merge 2 commits intoprecice:mainfrom
s3n-w6i:error-message-for-invalid-event-data-names
Open

Add error message for invalid event data names#22
s3n-w6i wants to merge 2 commits intoprecice:mainfrom
s3n-w6i:error-message-for-invalid-event-data-names

Conversation

@s3n-w6i
Copy link

@s3n-w6i s3n-w6i commented Jan 29, 2026

During my profiling, I added an event to preCICE that wrote custom data named rank. When I went to run precice-profiling-export on it, I received the following error:

polars.exceptions.ShapeError: 13 column names provided for a DataFrame of width 12

After some digging, it turns out that this mismatch in columns is due to a collision between the rank field that is included by default in the exported CSV file and the rank I added as custom event data.

I added an assertion that catches this duplicate and prints a custom error message, so that the user knows what's going on:

AssertionError: Event data must not be named 'rank', because it collides with a built-in name

Alternatives considered

  • be able to use built-in names and instead:
    • prefix event data columns with something like "data_" (breaking)
    • or have duplicate names in the exported CSV files. Does not seem straightforward to implement, since we go through polars and polars does not allow for duplicated column names. Also, a consumer of the CSV file will likely have problems reading it.
  • doing nothing: Continue to have a misleading error message

Otherwise, this will cause the program to error with a column count
mismatch error. This is really hard to understand.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant