gchq/CyberChef · error · OperationError

Unknown type: ${kind}

Error message

Unknown type: ${kind}

What it means

The switch on the first character (kind) of a serialized element does not match any known type marker. Supported types are n (null), i (integer), d (double), b (boolean), a (array), and s (string). PHP objects (O:) and any other type are not supported, as stated in the operation description.

Source

Thrown at src/core/operations/PHPDeserialize.mjs:161

                case "a":
                    expect(":");
                    return "{" + handleArray() + "}";

                case "s": {
                    expect(":");
                    const length = readUntil(":");
                    expect("\"");
                    const value = read(length);
                    expect('";');
                    if (args[0]) {
                        return '"' + value.replace(/"/g, '\\"') + '"'; // lgtm [js/incomplete-sanitization]
                    } else {
                        return '"' + value + '"';
                    }
                }

                default:
                    throw new OperationError("Unknown type: " + kind);
            }
        }

        const inputPart = input.split("");
        return handleInput();
    }

}

export default PHPDeserialize;

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Remove or convert serialized object (O:) elements before deserializing — only null, int, double, bool, array, and string are supported
  2. Verify the input is genuinely PHP-serialized data and not another format
  3. If objects are needed, convert them to associative arrays (a:) in PHP before serializing
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check: reject serialized objects (O:) which are unsupported
function hasObjects(s) {
  return /(^|;)O:\d+:"/.test(s);
}
if (hasObjects(input)) {
  throw new Error("PHP serialized objects (O:) are not supported by this operation.");
}

Try / catch

try {
  const result = chef.phpDeserialize(input, [true]);
} catch (e) {
  if (/Unknown type/i.test(e.message)) {
    console.error("Unsupported type encountered — objects (O:) are not supported");
  } else { throw e; }
}

Prevention

When it happens

Trigger: The input contains a PHP serialized object: O:4:"Date":0:{}. The input is not PHP serialized data at all (starts with an unexpected character). A private/protected property serialization using null-byte prefixes that the lowercase read misinterprets.

Common situations: Trying to deserialize data that includes PHP objects (the operation explicitly states 'This function does not support object tags'). Feeding arbitrary non-serialized text into the operation.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/6e7e5da6038bc14e. Report an issue: GitHub.