Error handling

In the event that the critical-information API returns an error, the response body will contain a error message in JSON format in accordance with the OperationOutcome FHIR standard.

The error code and other details can be found in OperationOutcome.issue.details.coding by searching for the relevant coding system shown in the example below.

The error message can be found in OperationOutcome.issue.diagnostics, and the event ID for the request in OperationOutcome.id.

The FHIR path in which the error occured is in OperationOutcome.issue.location. It may be empty.

Example of a error response body returned from the API:

{
  "resourceType": "OperationOutcome",
  "id": "c65f8f64-2c9c-4624-a4f0-3dbc4bde3300",
  "issue": [
    {
      "severity": "fatal",
      "code": "invariant",
      "diagnostics": "Invalid element content - max: 500",
      "location": [
        "Condition.note"
      ],
      "details": {
        "coding": [
          {
            "system": "http://nhn.no/hit/fhir/error/CodeSystem/ErrorCode",
            "code": "KI-0014"
          },
          {
            "system": "http://nhn.no/hit/fhir/error/CodeSystem/ApiVersion",
            "code": "v1"
          },
          {
            "system": "http://nhn.no/hit/fhir/error/CodeSystem/ApplicationVersion",
            "code": "8527aa3a"
          },
          {
            "system": "http://nhn.no/hit/fhir/error/CodeSystem/Environment",
            "code": "test1"
          },
          {
            "system": "http://nhn.no/hit/fhir/error/CodeSystem/ServiceName",
            "code": "critical-information"
          }
        ]
      }
    }
  ]
}

Error Codes

Authorization

For errors related to authorization go here.

Application Error Codes

Error codes has prefix "KI" (capital i).

In order to support Kjernejournal backwards compatibility we've kept some of the old error codes (prefix KJF). We're also sending all error codes in the response header X-KJ-Feilkode to keep backwards compatibility. Other Kjernejournal error codes which are not listed below are no longer in use for critical-information. Note that both the old Kjernejournal error codes and response header will be phased out in future API-versions.

Error code Cause
KI-0001 Failure during init of application.
KI-0002 When something fails in a sheduled job.
KI-0003 Migrating data from KJ classic fails.
KI-0004 Something went wrong communicating with Kafka.
KI-0005 A batch job failed.
KI-0006 Internal technical errors.
KI-0007 Some part of the http request is invalid like e.g. the body. See error message for details.
KI-0008 Cannot merge patient nins.
KI-0009 An error related to id-mapping.
KI-0010 The patient nin in the FHIR resource does not match the patient nin in the header.
KI-0011 Updating an old version of a Critical Information record is not allowed.
KI-0012 The operation is not implemented. See error message for details.
KI-0013 No changes were detected in the update.
KI-0014 A field in the FHIR profile is invalid. See error message for details.
KI-0015 The requested Critical Information record does not exist.
KI-0016 A business rule was violated. See error message for details.
KI-0017 A user does not have access to the requested endpoint. See error message for details.
KJF-000352 A user tried to lookup a patient but has been blocked by the patient (blokkering).
KJF-000179 A user is requesting access to data which the patient has restricted access (sperring).