Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Environment builders panic on a document they cannot deserialise

Open Beginner friendly
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
api, backend

Research direction

The issue points to src/environments/builders.rs and the functions build_environment_struct and build_environment_api_key_struct. Start by examining these functions and their current use of serde_json::from_value(value).unwrap(). Understand the Environment and EnvironmentAPIKey structs and their Serde deserialization. The task is to change the return types to Result<Environment, serde_json::Error> and Result<EnvironmentAPIKey, serde_json::Error>, then update any callers. Check for other usages in the codebase and the linked client issue to ensure compatibility. Running existing tests will verify the change doesn't break functionality.

Written by the indexing model from the issue text.

Description

build_environment_struct and build_environment_api_key_struct in src/environments/builders.rs are serde_json::from_value(value).unwrap(). A document the engine cannot deserialise panics the caller instead of returning an error. The input is whatever the network delivered, so a misbehaving server, or anyone on the path of a plain-HTTP self-hosted deployment, can crash every process embedding the engine, and callers have no way to catch it short of catch_unwind.

In flagsmith-rust-client 3.1.1 that panic happened on the SDK's background refresh thread while it held the datastore mutex, which poisoned the lock and made every later flag read panic as well. Flagsmith/flagsmith-rust-client#62 fixes that on the client side by deserialising the document itself with an error return, so the client no longer calls these builders. Any other caller still gets the panic.

Proposed: return Result<Environment, serde_json::Error> and Result<EnvironmentAPIKey, serde_json::Error> from the two builders. That is a breaking change to the public API, so it wants a version bump and updates to the callers, the Rust client included. Happy to send a PR if this works.

Dominant language
Rust
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Flagsmith/flagsmith-rust-flag-engine

All issues in Flagsmith/flagsmith-rust-flag-engine

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.