{"record":{"id":"aecd25920aad3010","repo":"JanDeDobbeleer/oh-my-posh","slug":"no-location-configured-set-city-country-or-latitu","errorCode":null,"errorMessage":"no location configured: set city+country or latitude+longitude","messagePattern":"no location configured: set city\\+country or latitude\\+longitude","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/segments/ramadan.go","lineNumber":225,"sourceCode":"\tmethod := r.options.Int(RamadanMethod, 3)\n\tschool := r.options.Int(RamadanSchool, 0)\n\n\tcity := r.options.String(RamadanCity, \"\")\n\tcountry := r.options.String(RamadanCountry, \"\")\n\n\tif city != \"\" && country != \"\" {\n\t\treturn fmt.Sprintf(\n\t\t\t\"https://api.aladhan.com/v1/timingsByCity/%s?city=%s&country=%s&method=%d&school=%d\",\n\t\t\tdate,\n\t\t\turl.QueryEscape(city),\n\t\t\turl.QueryEscape(country),\n\t\t\tmethod,\n\t\t\tschool,\n\t\t), nil\n\t}\n\n\tif r.options.Any(RamadanLatitude, nil) == nil || r.options.Any(RamadanLongitude, nil) == nil {\n\t\treturn \"\", errors.New(\"no location configured: set city+country or latitude+longitude\")\n\t}\n\n\tlat := r.options.Float64(RamadanLatitude, 0)\n\tlng := r.options.Float64(RamadanLongitude, 0)\n\n\treturn fmt.Sprintf(\n\t\t\"https://api.aladhan.com/v1/timings/%s?latitude=%g&longitude=%g&method=%d&school=%d\",\n\t\tdate, lat, lng, method, school,\n\t), nil\n}\n\n// Returns whether today is in Ramadan and the roza (day) number. When first_roza_date is\n// set it overrides the API's Hijri month detection.\nfunc (r *Ramadan) resolveRamadanDay(now time.Time, data ramadanData, firstRozaStr string) (bool, int) {\n\tif firstRozaStr != \"\" {\n\t\tfirstRoza, err := time.ParseInLocation(\"2006-01-02\", firstRozaStr, now.Location())\n\t\tif err == nil {\n\t\t\t// Use UTC noon arithmetic to avoid DST off-by-one errors.","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/ramadan.go#L207-L243","documentation":"The ramadan segment builds an Aladhan API URL from either city+country or latitude+longitude. buildURL raises this error when city+country are not both set and either latitude or longitude is missing entirely from the options, because it cannot form any location query.","triggerScenarios":"Configuring a ramadan segment with only city (no country), only country (no city), only latitude (no longitude), only longitude (no latitude), or none of the four options at all.","commonSituations":"Users assuming city alone suffices, copying a config and deleting one half of a coordinate pair, or omitting all location options expecting IP-based geolocation (the segment does not do that).","solutions":["Set both city and country (city+country takes precedence when both present).","Or set both latitude and longitude as numbers.","Remember partial pairs are rejected: city without country, or lat without lng, still fails.","Check for template/typo issues in option names (e.g. \"latitude\" not \"lat\")."],"exampleFix":"// before\n\"type\": \"ramadan\",\n\"city\": \"Karachi\"\n// after\n\"type\": \"ramadan\",\n\"city\": \"Karachi\",\n\"country\": \"Pakistan\"\n// or: \"latitude\": 24.86, \"longitude\": 67.0","handlingStrategy":"validation","validationCode":"const hasCity = Boolean(cfg.city && cfg.country)\nconst hasCoords = cfg.latitude != null && cfg.longitude != null\nif (!hasCity && !hasCoords) {\n  throw new Error(\"ramadan segment: provide city+country or latitude+longitude\")\n}","typeGuard":null,"tryCatchPattern":"if err := r.setData(); err != nil {\n  if strings.Contains(err.Error(), \"no location configured\") {\n    log.Warn(\"ramadan: configure city+country or latitude+longitude\")\n    return false // hide segment\n  }\n  return false\n}","preventionTips":["Provide complete pairs: city AND country, or latitude AND longitude.","Remember city+country wins when both forms are set; don't mix partials.","Use option names exactly as documented: latitude, longitude, city, country.","There is no IP-based geolocation fallback — always configure a location explicitly."],"tags":["config","ramadan","missing-option","validation"],"backgroundTag":"missing-config-option","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}