// context projectapi

Dataset Troubleshooting

401 Unauthorized

Check which token you are using.

For dataset metadata, schema, and query:

Authorization: Bearer pat_xxx

For ingest:

Authorization: Bearer YOUR_PROJECT_API_KEY

PATs are for Loguro API control-plane routes. Project API keys are for ingest routes.

Project not found

For Loguro API routes, the projectSlug comes from the URL:

/api/datasets/:projectSlug
/api/datasets/:projectSlug/:datasetId/schema
/api/datasets/:projectSlug/:datasetId/query

Loguro checks that the PAT owner has access to that project.

For ingest routes, the project comes from the API key claims. If the key is malformed or old, ingest may return:

{ "error": "Project not found in API token claims" }

Create a fresh project API key for that project.

Dataset not found

The datasetId does not belong to the project, or the dataset metadata was deleted.

Check the project datasets list:

curl https://logu.ro/api/datasets/local \
  -H "Authorization: Bearer pat_xxx"

Dataset schema not found

The dataset exists, but schema registration has not happened yet.

Register it first:

curl -X POST https://logu.ro/api/datasets/local/13/schema \
  -H "Authorization: Bearer pat_xxx" \
  -H "Content-Type: application/json" \
  --data '{"fields":{"country":"string","amount":"number"}}'

If ingest returns this error, confirm you are using the same datasetId that you registered.

Dataset limit reached

The plan limits how many dataset metadata records the user can create.

Reduce unused datasets or upgrade the plan.

Dataset schema already exists

Schemas are immutable.

For dataset-specific endpoints, register schema once per dataset. If the shape changed, create a new dataset and register the new schema there.

For legacy project-level schema endpoints, this can also mean the project’s default dataset already has a schema.

Extra field: ...

The payload includes a top-level key that is not:

  • timestamp
  • context
  • one of the declared schema fields

Move debug-only data into context, or create a new dataset with a new schema if the field needs to be queryable.

Missing field: ...

Every declared schema field is required on every record.

If a value is unknown, send a real value that matches the field type. v1 does not treat missing declared fields as null.

Invalid number field

Numbers must be JSON numbers, not strings:

Invalid:

{ "amount": "42.5" }

Valid:

{ "amount": 42.5 }

Invalid timestamp field

Timestamp fields must be strings that parse as timestamps:

{
  "timestamp": "2026-06-10T10:00:00Z",
  "signup_at": "2026-06-01T08:00:00Z"
}

Unix numbers are not accepted for timestamp fields in v1.

context must be an object

context is required and must be a JSON object.

Invalid:

{ "context": null }
{ "context": "debug" }
{ "context": [] }

Valid:

{ "context": {} }
{ "context": { "source": "api", "request_id": "req_123" } }

Query returns empty rows

Check:

  • The dataset exists.
  • The dataset schema exists.
  • Records were ingested successfully.
  • Your range includes the record timestamp.
  • You are querying the same projectSlug and datasetId.
  • You are filtering on values that actually exist.

Remember that the default range is the last 7 days.

Unknown field

Dataset queries can use only:

  • declared schema fields
  • timestamp

context is stored but not queryable in v1.

Invalid:

{ "field": "context.source", "op": "=", "value": "api" }

Valid if source is declared as a top-level schema field:

{ "field": "source", "op": "=", "value": "api" }

sum requires a number field

sum and avg only work on fields declared as number.

If you need numeric aggregation, declare the field as number before ingesting data.

Quota exceeded

Dataset record quota is separate from logs and web analytics.

The response includes quota details:

{
  "error": "Quota exceeded",
  "quota": {
    "current": 1000,
    "limit": 1000,
    "remaining": 0
  }
}

Upgrade the plan, reduce volume, or contact support if the dataset should be unlimited.

Checklist

For a clean end-to-end test:

  1. Create dataset metadata with PAT.
  2. Copy the returned datasetId.
  3. Register schema with POST /api/datasets/:projectSlug/:datasetId/schema.
  4. Confirm GET /api/datasets/:projectSlug/:datasetId/schema returns it.
  5. Send one valid record to https://ingest.logu.ro/datasets/:datasetId.
  6. Send one invalid record with an extra field and confirm it returns 400.
  7. Query POST /api/datasets/:projectSlug/:datasetId/query with a range that includes the record timestamp.
  8. Confirm the query uses the same project slug for the project that owns the ingest key, and the same datasetId as ingest.
// related

See also