{"record":{"id":"dae542e381f0368f","repo":"JanDeDobbeleer/oh-my-posh","slug":"failed-to-parse-fajr-time-w","errorCode":null,"errorMessage":"failed to parse Fajr time: %w","messagePattern":"failed to parse Fajr time: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/segments/ramadan.go","lineNumber":126,"sourceCode":"\tdata := response.Data\n\n\t// Determine if we are currently in Ramadan and compute the roza number.\n\tfirstRozaStr := r.options.String(RamadanFirstRozaDate, \"\")\n\thideOutside := r.options.Bool(RamadanHideOutside, true)\n\n\tinRamadan, rozaNumber := r.resolveRamadanDay(now, data, firstRozaStr)\n\n\tif !inRamadan && hideOutside {\n\t\treturn errNotRamadan\n\t}\n\n\tif inRamadan {\n\t\tr.RozaNumber = rozaNumber\n\t}\n\n\tfajrTime, err := parseEventTime(now, data.Timings.Fajr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse Fajr time: %w\", err)\n\t}\n\n\tiftarTime, err := parseEventTime(now, data.Timings.Maghrib)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse Iftar time: %w\", err)\n\t}\n\n\timsakTime, err := parseEventTime(now, data.Timings.Imsak)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse Imsak time: %w\", err)\n\t}\n\n\tr.Fajr = fajrTime.Format(\"15:04\")\n\tr.Iftar = iftarTime.Format(\"15:04\")\n\tr.Imsak = imsakTime.Format(\"15:04\")\n\n\t// When past Iftar, fetch tomorrow's Fajr from the API for a DST-accurate countdown.\n\t// Falls back to the same wall-clock time on the next calendar day if the fetch fails.","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/ramadan.go#L108-L144","documentation":"The ramadan segment fetches prayer times from the Aladhan API and parses the Fajr timing string (e.g. \"05:12 (EET)\") into a time.Time for the current day via parseEventTime. This error wraps whatever went wrong during that parse — typically the timing string from the API does not match the expected time format.","triggerScenarios":"The Aladhan API response's data.timings.Fajr is missing, empty, or in an unexpected format (e.g. includes a timezone suffix or 12-hour format the parser doesn't accept), or the API schema changed.","commonSituations":"API returns timings in a different convention for some methods/schools, a proxy/captive portal returns HTML instead of JSON-ish timings, upstream schema change in Aladhan API responses.","solutions":["Update oh-my-posh to the latest version so the parser matches the current Aladhan API format","Call the API URL manually (the segment logs it) and inspect data.timings.Fajr to see the actual format","Try a different `method` value in the segment options, which changes the timing format returned","Check network health — a captive portal or error page can corrupt the response"],"exampleFix":"// before: API returns Fajr as \"05:12\" but with suffix\n\"Fajr\": \"05:12 (EET)\"  // parse fails\n// after: update oh-my-posh / choose method option that returns \"05:12\"\n[[blocks.segments]]\ntype = \"ramadan\"\n[blocks.segments.properties]\nmethod = 2","handlingStrategy":"fallback","validationCode":"const res = await fetch(apiUrl);\nconst body = await res.json();\nif (!body?.data?.timings?.Fajr) throw new Error(\"missing Fajr timing\");","typeGuard":"function hasFajr(d) {\n  return d?.data?.timings?.Fajr != null && /\\d{1,2}:\\d{2}/.test(d.data.timings.Fajr);\n}","tryCatchPattern":"try {\n  const t = parseEventTime(now, data.Timings.Fajr);\n} catch (e) {\n  // fall back to hiding the segment rather than failing the prompt\n}","preventionTips":["Keep oh-my-posh updated for Aladhan API format changes","Verify the API URL returns timings in the expected HH:MM format","Pick a standard `method` option value for consistent timing formats","Monitor api.aladhan.com availability"],"tags":["go","http","time-parsing","api","ramadan-segment"],"backgroundTag":"time-string-parse-failed","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}