When something goes wrong

The messages you will meet, and what to do about them.

These are the messages you are most likely to meet, in Barnark’s own words, each with what it means and what to do. The messages shown were produced by the real commands; paths are shortened with “…”.

Setting up #

There is no barn #

$ vendor/bin/barnark template:list
 [ERROR] There is no barn in "…/hotel" or any folder above it: no .barn folder
         was found. Start one with `barnark init`.

Barnark only works inside a barn, and looks for a .barn/ folder in the current folder and every folder above it.

What to do: run vendor/bin/barnark init at the project’s root, or run the command from inside the project.

No template is bound here #

$ vendor/bin/barnark template:check
Barn: …/hotel

 [ERROR] No template is bound here. Make an ark with `barnark template:clone
         <your template> <ark> <directory>`, or pass a template and
         directory to check.

The project has no ark yet, so there is nothing to check.

What to do: make one with template:clone from a template of your own, or name a shipped template and a directory to check.

can’t be read #

$ vendor/bin/barnark template:check
Barn: …/hotel

Checking the ark 'Hotel', …/hotel/src, against 'Hotel'
======================================================

 [ERROR] Template 'Hotel' can't be read: The revision file
         '…/hotel/.barn/barnark/catalogue/template-history' cannot be used:
         Syntax error.

A template file was changed outside Barnark.

What to do: restore the file from git. Don’t edit the template files by hand.

Cloning and copying #

is shipped with Barnark #

$ vendor/bin/barnark template:clone Library Pricing ./lib
Barn: …/hotel

 [ERROR] 'Library' is shipped with Barnark, and an ark is made only from one of
         your templates. Copy it first, for example `barnark template:copy
         "Library" "My Library"`, then make the ark from the copy.

An ark is made only from a template of your own, so a shipped one stays as it shipped.

What to do: run the template:copy it suggests, then template:clone with your copy.

cannot name an ark #

$ vendor/bin/barnark template:clone "My Library" "Shop: east" ./lib
Barn: …/hotel

 [ERROR] 'Shop: east' cannot name an ark: it has one of / \ : * ? " < > |.

An ark’s name also names its own template, so it follows a template name’s rules: no leading or trailing dot, and none of / \ : * ? " < > |.

What to do: choose a name without them.

The project has an ark of that name already #

$ vendor/bin/barnark template:clone "My Library" HOTEL ./lib
Barn: …/hotel

 [ERROR] 'HOTEL' cannot name an ark: the project has an ark called 'Hotel'
         already.

An ark’s name is unique in the project, ignoring case.

What to do: choose another name. ark:list lists the arks.

is outside the project #

$ vendor/bin/barnark template:clone "My Library" Pricing ../pricing
Barn: …/hotel

 [ERROR] '../pricing' is outside the project at …/hotel, so it can't be tracked.
         Run this from inside the project, or add --outside to make it an ark
         outside the barn's root.

An ark’s folder can be anywhere on your computer, but Barnark asks you to say so.

What to do: add --outside if that is what you mean.

$ vendor/bin/barnark template:check hotel
Barn: …/hotel

 [WARNING] The ark 'hotel' and its folder disagree: its folder has no
           .barn-ark.json pointing to this barn.

The project’s record and the ark’s link file say different things: the folder was moved, the link file was deleted, or the link points at another project.

What to do: decide which is right. Barnark never repairs it for you.

can’t name a template #

$ vendor/bin/barnark template:copy Hotel "domain driven design"
Barn: …/hotel

 [ERROR] 'domain driven design' can't name a template: a shipped template is
         called 'Domain Driven Design'.

A template’s name can’t be one the project already has, or a shipped template’s name, ignoring case.

What to do: choose another name.

There is no template called #

$ vendor/bin/barnark template:clone Nope X ./lib
Barn: …/hotel

 [ERROR] There is no template called 'Nope'. `barnark template:list` lists
         them.

The name doesn’t match a shipped template or one of yours.

What to do: run template:list and use a name from it, in quotes if it has spaces.

Folder … does not exist #

$ vendor/bin/barnark template:clone "My Library" X ./nope/lib
Barn: …/hotel

 [ERROR] Folder '/nope' does not exist. Create that one first.

The folder above the one a clone would make doesn’t exist.

What to do: make the folder above it first, or clone into a folder that sits directly in the barn.

Adding folders #

does not offer a … #

$ vendor/bin/barnark template:new Widget Invoices app
Barn: …/hotel

 [ERROR] 'Shop' does not offer a 'Widget' in 'app'.

It offers:
  Feature

The folder’s template has no slot of that name there. Barnark lists the ones it has, rather than guessing.

What to do: use a slot from the list, or run template:offers <path> to see what the folder offers.

differs from it only by case #

$ vendor/bin/barnark template:new Feature invoices lib/Internal/Feature
Barn: …/hotel

 [ERROR] 'invoices' can't name a member: the folder 'Invoices' is already
         here, and differs from it only by case.

A member’s name can’t be one that is already there, even ignoring case.

What to do: choose another name.

… is a collection, which holds only members #

$ vendor/bin/barnark template:add-folder lib/Internal/Feature/Extras "x"
Barn: …/hotel

 [ERROR] The template can't take that change at 'lib/Internal/Feature/Extras':
         'Internal/Feature' is a collection, which holds only members of its
         member type.

A folder inside a collection would have to be a member, so that every member keeps the shape of its member type.

What to do: use template:new to add a member, or add the folder somewhere else.

the template has no folder … #

$ vendor/bin/barnark template:add-folder src/Foo/Bar "x"
Barn: …/hotel

 [ERROR] The template can't take that change at 'src/Foo/Bar': the template has no folder
         'Foo'.

The folder above the one you are adding isn’t in the template.

What to do: add the folder above first.

Checking #

N inconsistency(ies) found #

The check found folders that are missing or unexpected, and exits with status 1.

What to do: Check the project says what to do about each.

There is no shipped template called ‘./src’ #

$ vendor/bin/barnark template:check ./src "Domain Driven Design"
Barn: …/hotel

 [ERROR] There is no shipped template called './src'.

With two arguments, the first names a shipped template and the second the directory.

What to do: put the template first: template:check "Domain Driven Design" ./src. For the bound folder, leave both out or give only the folder.

Deleting #

is an ark’s template … cannot be deleted #

$ vendor/bin/barnark template:delete Pricing -n
Barn: …/hotel

 [ERROR] 'Pricing' is the project's template, bound to '/lib', and cannot be
         deleted.

Shipped templates and the project’s own can’t be deleted.

What to do: delete one of your own unbound templates instead. Ending an ark’s life is not built yet.

Nothing was changed #

$ vendor/bin/barnark template:delete "Our Library"
Barn: …/hotel

 Delete 'Our Library' with every revision? Only git brings it back. (yes/no) [no]:
 > Nothing was changed.

Barnark asked whether to delete and did not get a yes, such as when it was run where it can’t ask.

What to do: if you mean it, add -n. Only git brings a deleted template back.

The browser app #

The port is taken #

barnark gui picks the next free port when the one asked for is in use, and prints the address it chose.

What to do: use the address it prints, or pass --port.

The page says there is no barn #

The server was started where no .barn/ folder was found at or above the current folder.

What to do: let the page make one in the folder it was started in, or start it from inside the project.