Skip to content

Fatal error on clean install #764

Closed

Description

@robindbe

Describe the bug
We have a rather large install base and the RESTAPI works fine on all of them, except for 1 cluster (I have no idea what makes it special, its like anything else we have).

It originally ran on 24.03 (and API 2.4.3) and we got the same error. I tried, reinstalling the package, rebooting and even upgrading but always the same error popped up. We then did a clean install of the machine (from the ISO) and even with the bare minimum of config (so no config restore has been done yet), this error shows up when clicking on the REST API menu entry. Installation itself goes fine.

[03-Oct-2025 10:31:26 Europe/Brussels] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /usr/local/pkg/RESTAPI/Models/RESTAPIVersion.inc:194
Stack trace:
#0 /usr/local/pkg/RESTAPI/Models/RESTAPIVersion.inc(140): RESTAPI\Models\RESTAPIVersion->get_all_available_versions()
#1 /usr/local/pkg/RESTAPI/Models/RESTAPIVersion.inc(73): RESTAPI\Models\RESTAPIVersion->get_latest_api_version()
#2 /usr/local/pkg/RESTAPI/Core/Model.inc(868): RESTAPI\Models\RESTAPIVersion->get_api_version_details()
#3 /usr/local/pkg/RESTAPI/Core/Model.inc(906): RESTAPI\Core\Model->get_internal_objects()
#4 /usr/local/pkg/RESTAPI/Core/Model.inc(445): RESTAPI\Core\Model->from_internal()
#5 /usr/local/pkg/RESTAPI/Core/Model.inc(345): RESTAPI\Core\Model->construct_from_internal()
#6 /usr/local/pkg/RESTAPI/Models/RESTAPIVersion.inc(63): RESTAPI\Core\Model->__construct()
#7 /usr/local/pkg/RESTAPI/Models/RESTAPISettings.inc(238): RESTAPI\Models\RESTAPIVersion->__construct()
#8 /usr/local/pkg/RESTAPI/Core/Field.inc(319): RESTAPI\Models\RESTAPISettings->get_override_sensitive_fields_choices()
#9 /usr/local/pkg/RESTAPI/Core/Field.inc(1124): RESTAPI\Core\Field->set_choices_from_callable()
#10 /usr/local/pkg/RESTAPI/Core/Form.inc(205): RESTAPI\Core\Field->to_form_input()
#11 /usr/local/pkg/RESTAPI/Core/Form.inc(364): RESTAPI\Core\Form->get_form()
#12 /usr/local/www/system_restapi_settings.php(10): RESTAPI\Core\Form->print_form()
#13 {main}
  thrown in /usr/local/pkg/RESTAPI/Models/RESTAPIVersion.inc on line 194

To Reproduce
Steps to reproduce the behavior:

  1. Click on REST API menu item.

Expected behavior
No crash.

Screenshots or Response
See error message.

pfSense Version & Package Version:

  • pfSense Version: 25.07.1
  • Package Version 2.6.2

Additional context
I saw similar errors in #691 and I tried the command pfsense-restapi refreshcache RESTAPIVersionReleasesCache but that does not solve anything.

If there is REST API config present, the actual API calls themselves still work.

Activity

  1. jaredhendrickson13 commented on Oct 4, 2025

    @jaredhendrickson13
    Member

    This suggests the direct cause is an issue with the package's releases cache that is fetched from GitHub periodically. Either the cache file has been polluted, is missing, or is otherwise malformed. If you can provide the contents of /usr/local/pkg/RESTAPI/.resources/cache/RESTAPIVersionReleasesCache.json, that should provide more context as to what's wrong. The update features likely won't work correctly in this state either.

    This does demonstrate an unexpected dependency on that cache file when loading the UI pages though. I do see where that issue is and will work on a fix for the next patch.

  2. linked a pull request that will close this issuev2.6.3 Fixes #765on Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions