# E-LINT-004: handler not generated

Every request an app serves passes the access rules that `aicoded generate` writes from `<ssr:access>` and `//ssr:access`, so an app serves only the handlers the generator writes. In hand-written code, the options of `app.Main` and `app.Run` must be an `app.Options` composite literal written in the call itself, such as `app.Main(app.Options{Handler: pages.NewHandler(d)})`, so that lint sees every field the runner gets: a conversion such as `app.Options(o)`, a value of an unnamed struct type with the same fields, a variable, and options that a function returns, a function of a declared module included, are refused. `app.Main` and `app.Run` are only called directly; any other use, such as `f := app.Main`, is refused. `app.Options.Handler` must be a direct call of the app's generated `pages.NewHandler`, such as `pages.NewHandler(d)`, and `app.Options.RPC` a direct call of the generated `rpc.Server()`. A raw `http.Handler`, a handler wrapped in another, a function of the same name that the generator did not write, and `nil` are refused. The two fields are set only in the `app.Options` literal: an assignment such as `opts.Handler = h`, a `range` that assigns one, and a pointer such as `&opts.RPC` are refused, and so is a struct of another type with a `Handler http.Handler` or `RPC *rpc.Server` field that is set otherwise, since it could be converted into `app.Options`. A literal whose type is left out is read as well, such as each element of `[]*options{{h, ...}}` or `map[string]*options{"a": {h, ...}}`, also when the pointer type has another name. A keyed field such as `Handler:` is checked in every literal, whatever its type. A field named `Handler` or `RPC` whose type mentions a type parameter, such as `Handler H` in a generic struct `opts[H any]`, is refused wherever it is set: in a literal, keyed or by its place, by assignment, by `range`, through `&` and with `++` or `--`, since a type argument could make it an entry point of a struct converted into `app.Options`. A composite literal whose type is a type parameter or a pointer to one, such as `T{h, ...}` or each `{...}` in `[]T{{...}}` and `[]*T{{...}}`, is refused whatever the parameter's constraint, since lint cannot tell which fields it sets. A literal that only holds values of a type parameter, such as `[]T{a, b}`, is allowed. Use the concrete type.

**Fix:** call app.Main with an app.Options literal written in the call, with Handler: pages.NewHandler(...) and RPC: rpc.Server() directly in it, and serve every page from pages/.
