Skip to content

�� [CRITICAL BUG] SyntaxError in f-string formatting in chain_utils.py #495

@evmparser

Description

@evmparser

Description

A typo exists in an f-string within a logging call in chain_utils.py. The code contains f"Registering peer failed with: f{err_name}" with an erroneous nested f prefix, which will cause a SyntaxError at runtime when this error-handling branch is executed.

Location

hivemind_exp/chain_utils.py - error handling in peer registration

Severity

🔴 CRITICAL - This will crash the application when the specific error condition is triggered.

Impact

  • Application crashes when PeerIdAlreadyRegistered error occurs
  • Prevents graceful error handling and recovery
  • Node cannot continue operation after encountering this error
  • Makes the system fragile and unreliable in production

Current Code

logger.info(f"Registering peer failed with: f{err_name}")
#                                            ^ Extra 'f' prefix

Error Output

When this line is reached:

SyntaxError: f-string: invalid syntax

Proposed Solution

Remove the erroneous f prefix inside the f-string:

# Incorrect:
logger.info(f"Registering peer failed with: f{err_name}")

# Correct:
logger.info(f"Registering peer failed with: {err_name}")

Steps to Reproduce

  1. Trigger the PeerIdAlreadyRegistered error condition
  2. Code attempts to execute the logging statement
  3. Python raises SyntaxError

Additional Context

This is a simple typo but has critical impact. The error is latent and only manifests when the specific error path is executed, making it difficult to catch without comprehensive testing.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions