Solar Day Out Of Range
solar_day_out_of_range422
The instant falls outside the solar day (sunrise to next sunrise), or the computed day/night span is invalid.
What this means
A calculation that partitions a solar day — planetary horas, Tribhaga thirds, or related day/night strength — was asked to evaluate a Julian Day that is not inside that day's half-open interval from local sunrise to the next local sunrise, or the ephemeris-derived sunrise/sunset geometry produced a zero or negative span. We do not invent a plausible hora or strength for an out-of-range instant.
When you'll see this
- A panchanga, muhurta, varshaphal or shadbala calculation could not place the requested moment inside one sunrise-to-sunrise day for the place you sent.
- The sunrise, sunset and next sunrise for that place and date came out in an impossible order (a zero or negative day or night). This is rare and usually means the place or date is wrong, for example swapped latitude and longitude.
Learn more about how this works
Vedic day geometry is anchored to local sunrise. Hora, Tribhaga, and related helpers require sunrise_jd <= jd < next_sunrise_jd. Silent clamping to the first or last hora would return a classically wrong lord — the same defect class as inventing 06:00/18:00 sunrise. A non-positive span means the ephemeris returned impossible ordering; that is also a hard failure, not a default index.
Example response
{
"success": false,
"error": "solar_day_out_of_range",
"message": "The instant falls outside the solar day (sunrise to next sunrise), or the computed day/night span is invalid. Use an instant within that interval, or verify location and date.",
"details": [],
"retry_after": null,
"doc_url": "https://docs.asterwise.com/reference/errors/solar_day_out_of_range/",
"request_id": "3f2b8c1e-7a4d-4e9b-8c21-5d6f0a9b1e37",
"timestamp": "2026-05-25T12:34:56Z"
}
- Check the request: the date, the time, the timezone and the coordinates (latitude and longitude not swapped, east longitude positive).
- If the place is near the poles, you may get
sun_calculation_failedinstead; there is no ordinary sunrise to anchor the day. - If the input is right, the error is ours: contact support with the
request_idfrom the response.
Do not retry the same request: the result will not change. Log the request_id, the input and the details, show the user a clear message, and report it to support if the input is valid.
Python:
Production handler
- Python
- TypeScript
import httpx
def call_with_solar_day(url, headers, payload):
response = httpx.post(url, headers=headers, json=payload, timeout=30)
if response.status_code == 422:
body = response.json()
if body.get("error") == "solar_day_out_of_range":
raise ValueError(body.get("message"), body.get("details"))
response.raise_for_status()
return response.json()
async function callWithSolarDay(url: string, headers: Record<string, string>, payload: unknown) {
const response = await fetch(url, {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
if (response.status === 422) {
const body = await response.json();
if (body.error === "solar_day_out_of_range") {
throw new Error(body.message ?? "solar_day_out_of_range");
}
}
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return response.json();
}
Avoid this error by
Always obtain the SolarDay from the same JD you evaluate (solar_day_containing), and keep hora/Tribhaga calls inside that interval. Do not reuse a civil-date SolarDay across midnights without re-resolving.