Skip to content

Error in data.table::set(): not a resizable vector #7583

Description

@MLopez-Ibanez

I am the maintainer of irace. CRAN has notified me of an error that started with data.table 1.18.0. See https://www.stats.ox.ac.uk/pub/bdr/M1mac/irace.out You can see one of the errors below.

This seems M1mac-specific. The same tests work in other targets.

I have no clue how to fix this problem. The error may be on my usage of data.table. In any case, any hints on how to fix or work-around the error would be welcome.

Thank you!

  ── Error ('test-targeteval.R:100:3'): target_evaluator maxTime ─────────────────
  Error in `set(self$experiment_log, j = "iteration", value = NULL)`: not a resizable vector
  Backtrace:
      ▆
   1. └─irace::irace(scenario = scenario) at test-targeteval.R:100:3
   2.   └─irace:::irace_common(scenario, simple = TRUE)
   3.     └─irace:::irace_run(scenario = scenario)
   4.       └─irace:::recoverFromFile(scenario$recoveryFile, scenario = scenario)
   5.         └─race_state$initialize(scenario, recover = TRUE)
   6.           └─data.table::set(self$experiment_log, j = "iteration", value = NULL)

Activity

  1. MichaelChirico commented on Jan 10, 2026

    @MichaelChirico
    Member

    we had tracked the {irace} issue in #7501, thought it was solved. will check again. cc @ben-schwen who might remember more details.

  2. aitap commented on Jan 10, 2026

    @aitap
    Member
  3. MLopez-Ibanez commented on Jan 10, 2026

    @MLopez-Ibanez
    ContributorAuthor

    Thank you! I can wait. He give me until 31 of January.

    If you want me to change the code in the package, please let me know. I can also submit a new version to force a rebuild in CRAN. Unfortunately, I don't have access to this M1mac target for testing.

  4. ben-schwen commented on Jan 12, 2026

    @ben-schwen
    Member

    I cannot reproduce the error on my Ubuntu system.

    The shown error is probably due to serialization. You probably serialize and deserialize self$experiment_log at some point. You can check this either via

    truelength(self$experiment_log)` # will show 0
    .Internal(inspect(self$experiment_log)) # which shows also the truelength as tl=0
    data.table:::selfrefok(self$experiment_log) # which will show -1

    All three of them should work. As pointed out by Ivan an intermediate submission of 1.18.0 did not catch this and tried to use set on such malformed data.table.

    However, the current version makees the selfrefok check and otherwise calls setalloccol(self$experiment_log) which fixes this.

    Hope that helps!

  5. aitap commented on Jan 12, 2026

    @aitap
    Member
  6. MLopez-Ibanez commented on Jan 12, 2026

    @MLopez-Ibanez
    ContributorAuthor

    If I have a serialised a data.table with a previous version, do I need to regenerate and resave with 1.18.0?

  7. ben-schwen commented on Jan 13, 2026

    @ben-schwen
    Member

    If I have a serialised a data.table with a previous version, do I need to regenerate and resave with 1.18.0?

    We should have fixed this by checking if the truelength and selfref are ok before resizing (both in adding as well as deleting columns). However, there might be some strange corner case where a data.table with a new R version > 4.5.0 and data.table > 1.18.0 is serialized and cannot be unserialized without setalloccol on an older data.table or R version (we need to check these!).

  8. aitap commented on Jan 15, 2026

    @aitap
    Member

    If I have a serialised a data.table with a previous version, do I need to regenerate and resave with 1.18.0?

    Ideally, any code that unserializes data.tables should then call setDT() on them. This should be enough for any data.table, whether originally created by 1.18.0 or an earlier version. Saving with 1.18.0 shouldn't be necessary. An older/newer setDT() will re-create the list of column pointers anyway; the newer function will make the list growable, and the older one will instead install a finalizer.

    The automatic fixes in set and the [ method only replace the data.table in the environment of the immediate caller of set (or the [ method). Any references to that data.table above in the function call stack stay invalid, and some or all by-reference changes may not propagate.

  9. MLopez-Ibanez commented on Jan 15, 2026

    @MLopez-Ibanez
    ContributorAuthor

    It seems the error has disappeared in CRAN: https://cran.r-project.org/web/checks/check_results_irace.html

    I'll contact Prof Ripley to make sure everything is OK.

  10. aitap commented on Jan 15, 2026

    @aitap
    Member
  11. MLopez-Ibanez commented on Jan 15, 2026

    @MLopez-Ibanez
    ContributorAuthor

    I highly recommend to double-check the code and tests that work with
    file paths. Try setting $TMPDIR to a path to a symbolic link and you
    might be able to find a bug in your tests. That one failure on M1mac
    was not completely spurious.

    Those are not failures in CRAN. They are printed as [FAILED] for me to look at in the future when I find time but they don't produce any errors/warnings/notes in CRAN.

    I'll hold sending any emails anyway since the failures have disappeared. Thanks for the advice!

  12. ben-schwen commented on Jan 17, 2026

    @ben-schwen
    Member

    So I guess we can close this here.

    Please feel free to reopen if the issue resurfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions