Skip to content

fix: make assignedDate and quotaResetDate optional in CopilotUsageModels#325

Open
hzyu3 wants to merge 1 commit intosteipete:mainfrom
hzyu3:fix/copilot-optional-dates
Open

fix: make assignedDate and quotaResetDate optional in CopilotUsageModels#325
hzyu3 wants to merge 1 commit intosteipete:mainfrom
hzyu3:fix/copilot-optional-dates

Conversation

@hzyu3
Copy link

@hzyu3 hzyu3 commented Feb 7, 2026

Problem

The Copilot tab in CodexBar shows "The data couldn't be read because it is missing" for users on trial/free Copilot plans.

Root Cause

GitHub's /copilot_internal/user API returns null for assigned_date and quota_reset_date fields on trial/free plans. However, CopilotUsageModels.swift declares these as non-optional String, causing a DecodingError.valueNotFound during JSON decoding.

Fix

Change assignedDate: String to String? and quotaResetDate: String to String? to handle null values gracefully.

Testing

Verified locally with a GitHub Copilot Individual (trial) account. Copilot usage now displays correctly:

== Copilot (api) ==
Premium: 80% left [=========---]
Chat: 100% left [============]
Plan: Individual

Fixes #162

GitHub's /copilot_internal/user API returns null for assigned_date and
quota_reset_date on trial/free Copilot plans, causing a
DecodingError.valueNotFound when decoding the JSON response.

This change makes both fields optional (String?) to handle null values
gracefully.

Fixes steipete#162
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.

Copilot error: The data couldn’t be read because it is missing.

2 participants