Skip to content

Fix version not showing in Docker container logs with robust error handling#9

Merged
cancel-cloud merged 2 commits intomainfrom
copilot/fix-8
Jul 22, 2025
Merged

Fix version not showing in Docker container logs with robust error handling#9
cancel-cloud merged 2 commits intomainfrom
copilot/fix-8

Conversation

Copy link
Contributor

Copilot AI commented Jul 22, 2025

Fixed an issue where the application version was not displaying in Docker container logs, showing only:

🚀 Idle Outpost Claimer gestartet.

Instead of the expected:

🚀 Idle Outpost Claimer v1.0.6 gestartet.

Root Cause

The issue was caused by lack of error handling around the version import and display logic. If the version.py module failed to import or if get_version() returned None/empty string in the Docker environment, the application could fail silently or display an incomplete message.

Solution

Added comprehensive error handling with multiple fallback strategies:

  1. Import Error Handling: Wraps the version import in try-catch with a fallback function
  2. Runtime Error Handling: Added robust error handling in show_startup_message()
  3. Clear Diagnostic Messages: Provides specific feedback for different failure scenarios

Error Handling Scenarios

  • Normal case: Shows v1.0.6
  • Import failure: Shows vunknown with warning message
  • Empty/None version: Shows v[version unavailable]
  • Runtime exception: Shows v[error: {message}]

Changes Made

  • Modified app.py with minimal, surgical changes (16 lines added, 2 lines modified)
  • No breaking changes to existing functionality
  • Preserves all existing behavior while adding robustness
  • Ensures version will always be displayed in logs regardless of environment issues

The fix ensures users will always see the version information in their Docker logs, with clear diagnostic information if any version detection issues occur.

Fixes #8.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: cancel-cloud <76657167+cancel-cloud@users.noreply.github.com>
Copilot AI changed the title [WIP] [bug] version not showing in logs Fix version not showing in Docker container logs with robust error handling Jul 22, 2025
Copilot AI requested a review from cancel-cloud July 22, 2025 19:42
Copy link
Owner

@cancel-cloud cancel-cloud left a comment

Choose a reason for hiding this comment

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

looks good, needs a real life deploy to see

@cancel-cloud cancel-cloud marked this pull request as ready for review July 22, 2025 19:55
@cancel-cloud cancel-cloud merged commit 94b0bfd into main Jul 22, 2025
@cancel-cloud cancel-cloud deleted the copilot/fix-8 branch July 22, 2025 19:55
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.

[bug] version not showing in logs

2 participants