Skip to content

Backend AppCenterHandler: return empty results when no AppCenter metadata service is present - #3866

Open
schlabsch wants to merge 2 commits into
OpenEMS:developfrom
schlabsch:fix/appcenter-null-metadata
Open

Backend AppCenterHandler: return empty results when no AppCenter metadata service is present#3866
schlabsch wants to merge 2 commits into
OpenEMS:developfrom
schlabsch:fix/appcenter-null-metadata

Conversation

@schlabsch

@schlabsch schlabsch commented Aug 4, 2026

Copy link
Copy Markdown

Problem

Deployments without an AppCenter metadata service — e.g. Metadata.File based setups, which have no Odoo/AppCenter backend — receive a hard JSON-RPC error for every appCenter/* request:

Objects.requireNonNull(metadata, "No AppCenter Metadata provided.");

Edges send getInstalledApps periodically and the UI issues appCenter requests on edge pages, so backend logs fill with JSON-RPC Error "No AppCenter Metadata provided." of type NullPointerException, and the 2026.x UI can crash when navigating away from pages that triggered these requests (observed on 2026.8.0: UI breaks when returning from the edge app view on a file-metadata deployment).

Fix

When the injected AppCenterMetadata is null, AppCenterHandler now returns benign empty results instead of throwing:

  • getInstalledApps{ "installedApps": [] }
  • getPossibleApps{ "bundles": [] }
  • getRegisteredKeys{ "keys": [] }
  • isKeyApplicable{ "isKeyApplicable": false, "additionalInfo": {} }
  • isAppFree{ "isAppFree": false }
  • history/write requests → generic empty success (no-op)

Clients degrade gracefully: the UI shows an empty App Center, Edges get valid empty responses, logs stay clean. Verified on a live 2026.8.0 deployment (file metadata, 6 edges): the UI navigation crash disappears and the appCenter requests return the empty results above.

Related: #3865 (same deployment class — file-based metadata with the split backend / backend-edge topology).

Deployments without an AppCenter metadata service (e.g. file-based
metadata) currently get a hard JSON-RPC error ('No AppCenter Metadata
provided.') for every appCenter request that Edges and the UI send
routinely (getInstalledApps, getPossibleApps, ...). The 2026.x UI does
not tolerate this error and can crash when navigating away from pages
that issue these requests; backend logs fill with NPE warnings.

Answer with benign empty results instead: empty installedApps/bundles/
keys, isKeyApplicable=false, isAppFree=false — so clients degrade
gracefully when the optional AppCenter service is absent.
) throws OpenemsNamedException {
Objects.requireNonNull(metadata, "No AppCenter Metadata provided.");
if (metadata == null) {
// OrbitEOS patch: no AppCenter metadata service in this deployment.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OrbitEOS Reference should be removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — removed.

) throws OpenemsNamedException {
Objects.requireNonNull(metadata, "No AppCenter Metadata provided.");
if (metadata == null) {
// OrbitEOS patch: see handleUserRequest.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OrbitEOS should be removed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — removed here as well.

@sfeilmeier

Copy link
Copy Markdown
Contributor

@michaelgrill: I'd like to have your opinion on this patch. Seems legit to me.
@schlabsch: Is this you? https://orbiteos.com/. It would be great to welcome you as a member of the OpenEMS Association (https://openems.io/association/). It's not expensive and helps the OpenEMS project a lot. We are also working on similar AI integrations, so maybe we could even collaborate on that.

schlabsch added a commit to schlabsch/openems that referenced this pull request Aug 17, 2026
Addresses review feedback on OpenEMS#3866.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGtVEQm5wxGwmpRKjr41Ly
schlabsch added a commit to schlabsch/openems that referenced this pull request Aug 17, 2026
@schlabsch
schlabsch force-pushed the fix/appcenter-null-metadata branch from c389754 to c0376e0 Compare August 17, 2026 03:49
schlabsch added a commit to schlabsch/openems that referenced this pull request Aug 17, 2026
@schlabsch
schlabsch force-pushed the fix/appcenter-null-metadata branch from c0376e0 to 4414a4c Compare August 17, 2026 03:55
@schlabsch
schlabsch force-pushed the fix/appcenter-null-metadata branch from 4414a4c to 77028ad Compare August 17, 2026 04:22
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.

3 participants